Skip to content

Apache Lucene open-source search software

LUCENE-2142: don't check if term count exceeds doc count in getStringIndex

Michael McCandless6ebcc95ea094
diff --git a/CHANGES.txt b/CHANGES.txt
index c5db72f784a..3ed6244a631 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -42,6 +42,9 @@ Bug fixes
* LUCENE-2132: Fix the demo result.jsp to use QueryParser with a
Version argument. (Brian Li via Robert Muir)
+
+* LUCENE-2142: FieldCacheImpl.getStringIndex no longer throws an
+ exception when term count exceeds doc count. (Mike McCandless)
New features
diff --git a/src/java/org/apache/lucene/search/FieldCacheImpl.java b/src/java/org/apache/lucene/search/FieldCacheImpl.java
index c669c52dda1..56b92d776bf 100644
--- a/src/java/org/apache/lucene/search/FieldCacheImpl.java
+++ b/src/java/org/apache/lucene/search/FieldCacheImpl.java
@@ -624,10 +624,6 @@ class FieldCacheImpl implements FieldCache {
if (term==null || term.field() != field) break;
// store term text
- // we expect that there is at most one term per document
- if (t >= mterms.length) throw new RuntimeException ("there are more terms than " +
- "documents in field \"" + field + "\", but it's impossible to sort on " +
- "tokenized fields");
mterms[t] = term.text();
termDocs.seek (termEnum);