lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rm...@apache.org
Subject svn commit: r1670368 - /lucene/dev/branches/lucene6271/lucene/core/src/java/org/apache/lucene/search/MultiPhraseQuery.java
Date Tue, 31 Mar 2015 15:52:33 GMT
Author: rmuir
Date: Tue Mar 31 15:52:33 2015
New Revision: 1670368

URL: http://svn.apache.org/r1670368
Log:
LUCENE-6271: fix MultiPhraseQuery's positions check

Modified:
    lucene/dev/branches/lucene6271/lucene/core/src/java/org/apache/lucene/search/MultiPhraseQuery.java

Modified: lucene/dev/branches/lucene6271/lucene/core/src/java/org/apache/lucene/search/MultiPhraseQuery.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6271/lucene/core/src/java/org/apache/lucene/search/MultiPhraseQuery.java?rev=1670368&r1=1670367&r2=1670368&view=diff
==============================================================================
--- lucene/dev/branches/lucene6271/lucene/core/src/java/org/apache/lucene/search/MultiPhraseQuery.java
(original)
+++ lucene/dev/branches/lucene6271/lucene/core/src/java/org/apache/lucene/search/MultiPhraseQuery.java
Tue Mar 31 15:52:33 2015
@@ -190,6 +190,11 @@ public class MultiPhraseQuery extends Qu
         return null;
       }
 
+      // TODO: move this check to createWeight to happen earlier to the user?
+      if (!fieldTerms.hasPositions()) {
+        throw new IllegalStateException("field \"" + field + "\" was indexed without position
data; cannot run PhraseQuery (phrase=" + getQuery() + ")");
+      }
+
       // Reuse single TermsEnum below:
       final TermsEnum termsEnum = fieldTerms.iterator(null);
 
@@ -230,13 +235,6 @@ public class MultiPhraseQuery extends Qu
           termsEnum.seekExact(term.bytes(), termState);
           postingsEnum = termsEnum.postings(liveDocs, null, PostingsEnum.POSITIONS);
 
-          // nocommit: check
-          if (postingsEnum == null) {
-            // term does exist, but has no positions
-            assert termsEnum.postings(liveDocs, null, PostingsEnum.NONE) != null: "termstate
found but no term exists in reader";
-            throw new IllegalStateException("field \"" + term.field() + "\" was indexed without
position data; cannot run PhraseQuery (term=" + term.text() + ")");
-          }
-
           docFreq = termsEnum.docFreq();
         }
 



Mime
View raw message