You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by mi...@apache.org on 2010/06/24 14:09:26 UTC
svn commit: r957519 -
/lucene/dev/branches/branch_3x/lucene/src/java/org/apache/lucene/search/FieldCacheImpl.java
Author: mikemccand
Date: Thu Jun 24 12:09:26 2010
New Revision: 957519
URL: http://svn.apache.org/viewvc?rev=957519&view=rev
Log:
LUCENE-2142: also in .getStrings, stop loading if we hit too many terms
Modified:
lucene/dev/branches/branch_3x/lucene/src/java/org/apache/lucene/search/FieldCacheImpl.java
Modified: lucene/dev/branches/branch_3x/lucene/src/java/org/apache/lucene/search/FieldCacheImpl.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/lucene/src/java/org/apache/lucene/search/FieldCacheImpl.java?rev=957519&r1=957518&r2=957519&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/lucene/src/java/org/apache/lucene/search/FieldCacheImpl.java (original)
+++ lucene/dev/branches/branch_3x/lucene/src/java/org/apache/lucene/search/FieldCacheImpl.java Thu Jun 24 12:09:26 2010
@@ -586,8 +586,17 @@ class FieldCacheImpl implements FieldCac
final String[] retArray = new String[reader.maxDoc()];
TermDocs termDocs = reader.termDocs();
TermEnum termEnum = reader.terms (new Term (field));
+ final int termCountHardLimit = reader.maxDoc();
+ int termCount = 0;
try {
do {
+ if (termCount++ == termCountHardLimit) {
+ // app is misusing the API (there is more than
+ // one term per doc); in this case we make best
+ // effort to load what we can (see LUCENE-2142)
+ break;
+ }
+
Term term = termEnum.term();
if (term==null || term.field() != field) break;
String termval = term.text();