You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by rj...@apache.org on 2015/03/31 18:38:50 UTC

svn commit: r1670384 - in /lucene/dev/branches/lucene6271: lucene/core/src/test/org/apache/lucene/index/ lucene/sandbox/src/java/org/apache/lucene/search/ solr/core/src/java/org/apache/solr/handler/component/ solr/core/src/java/org/apache/solr/search/

Author: rjernst
Date: Tue Mar 31 16:38:50 2015
New Revision: 1670384

URL: http://svn.apache.org/r1670384
Log:
LUCENE-6271: fix more nocommits in postings tests and solr uses

Modified:
    lucene/dev/branches/lucene6271/lucene/core/src/test/org/apache/lucene/index/TestPostingsEnum.java
    lucene/dev/branches/lucene6271/lucene/sandbox/src/java/org/apache/lucene/search/TermAutomatonQuery.java
    lucene/dev/branches/lucene6271/solr/core/src/java/org/apache/solr/handler/component/QueryElevationComponent.java
    lucene/dev/branches/lucene6271/solr/core/src/java/org/apache/solr/search/SolrIndexSearcher.java

Modified: lucene/dev/branches/lucene6271/lucene/core/src/test/org/apache/lucene/index/TestPostingsEnum.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6271/lucene/core/src/test/org/apache/lucene/index/TestPostingsEnum.java?rev=1670384&r1=1670383&r2=1670384&view=diff
==============================================================================
--- lucene/dev/branches/lucene6271/lucene/core/src/test/org/apache/lucene/index/TestPostingsEnum.java (original)
+++ lucene/dev/branches/lucene6271/lucene/core/src/test/org/apache/lucene/index/TestPostingsEnum.java Tue Mar 31 16:38:50 2015
@@ -84,23 +84,19 @@ public class TestPostingsEnum extends Lu
     
     // we did not index positions
     PostingsEnum docsAndPositionsEnum = getOnlySegmentReader(reader).postings(new Term("foo", "bar"), PostingsEnum.POSITIONS);
-    // nocommit: check
-    assertNull(docsAndPositionsEnum);
+    assertNotNull(docsAndPositionsEnum);
     
     // we did not index positions
     docsAndPositionsEnum = getOnlySegmentReader(reader).postings(new Term("foo", "bar"), PostingsEnum.PAYLOADS);
-    // nocommit: check
-    assertNull(docsAndPositionsEnum);
+    assertNotNull(docsAndPositionsEnum);
     
     // we did not index positions
     docsAndPositionsEnum = getOnlySegmentReader(reader).postings(new Term("foo", "bar"), PostingsEnum.OFFSETS);
-    // nocommit: check
-    assertNull(docsAndPositionsEnum);
+    assertNotNull(docsAndPositionsEnum);
     
     // we did not index positions
     docsAndPositionsEnum = getOnlySegmentReader(reader).postings(new Term("foo", "bar"), PostingsEnum.ALL);
-    // nocommit: check
-    assertNull(docsAndPositionsEnum);
+    assertNotNull(docsAndPositionsEnum);
     
     iw.close();
     reader.close();
@@ -162,19 +158,19 @@ public class TestPostingsEnum extends Lu
     
     // we did not index positions
     PostingsEnum docsAndPositionsEnum = getOnlySegmentReader(reader).postings(new Term("foo", "bar"), PostingsEnum.POSITIONS);
-    assertNull(docsAndPositionsEnum);
+    assertNotNull(docsAndPositionsEnum);
     
     // we did not index positions
     docsAndPositionsEnum = getOnlySegmentReader(reader).postings(new Term("foo", "bar"), PostingsEnum.PAYLOADS);
-    assertNull(docsAndPositionsEnum);
+    assertNotNull(docsAndPositionsEnum);
     
     // we did not index positions
     docsAndPositionsEnum = getOnlySegmentReader(reader).postings(new Term("foo", "bar"), PostingsEnum.OFFSETS);
-    assertNull(docsAndPositionsEnum);
+    assertNotNull(docsAndPositionsEnum);
     
     // we did not index positions
     docsAndPositionsEnum = getOnlySegmentReader(reader).postings(new Term("foo", "bar"), PostingsEnum.ALL);
-    assertNull(docsAndPositionsEnum);
+    assertNotNull(docsAndPositionsEnum);
     
     iw.close();
     reader.close();

Modified: lucene/dev/branches/lucene6271/lucene/sandbox/src/java/org/apache/lucene/search/TermAutomatonQuery.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6271/lucene/sandbox/src/java/org/apache/lucene/search/TermAutomatonQuery.java?rev=1670384&r1=1670383&r2=1670384&view=diff
==============================================================================
--- lucene/dev/branches/lucene6271/lucene/sandbox/src/java/org/apache/lucene/search/TermAutomatonQuery.java (original)
+++ lucene/dev/branches/lucene6271/lucene/sandbox/src/java/org/apache/lucene/search/TermAutomatonQuery.java Tue Mar 31 16:38:50 2015
@@ -335,7 +335,6 @@ public class TermAutomatonQuery extends
 
     public EnumAndScorer(int termID, PostingsEnum posEnum) {
       this.termID = termID;
-      // nocommit: check uses
       this.posEnum = posEnum;
     }
   }

Modified: lucene/dev/branches/lucene6271/solr/core/src/java/org/apache/solr/handler/component/QueryElevationComponent.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6271/solr/core/src/java/org/apache/solr/handler/component/QueryElevationComponent.java?rev=1670384&r1=1670383&r2=1670384&view=diff
==============================================================================
--- lucene/dev/branches/lucene6271/solr/core/src/java/org/apache/solr/handler/component/QueryElevationComponent.java (original)
+++ lucene/dev/branches/lucene6271/solr/core/src/java/org/apache/solr/handler/component/QueryElevationComponent.java Tue Mar 31 16:38:50 2015
@@ -693,14 +693,11 @@ public class QueryElevationComponent ext
           term.copyChars(id);
           if (seen.contains(id) == false  && termsEnum.seekExact(term.get())) {
             postingsEnum = termsEnum.postings(liveDocs, postingsEnum, PostingsEnum.NONE);
-            // nocommit: check, maybe just remove null check?
-            if (postingsEnum != null) {
-              int docId = postingsEnum.nextDoc();
-              if (docId == DocIdSetIterator.NO_MORE_DOCS ) continue;  // must have been deleted
-              termValues[ordSet.put(docId)] = term.toBytesRef();
-              seen.add(id);
-              assert postingsEnum.nextDoc() == DocIdSetIterator.NO_MORE_DOCS;
-            }
+            int docId = postingsEnum.nextDoc();
+            if (docId == DocIdSetIterator.NO_MORE_DOCS ) continue;  // must have been deleted
+            termValues[ordSet.put(docId)] = term.toBytesRef();
+            seen.add(id);
+            assert postingsEnum.nextDoc() == DocIdSetIterator.NO_MORE_DOCS;
           }
         }
       }

Modified: lucene/dev/branches/lucene6271/solr/core/src/java/org/apache/solr/search/SolrIndexSearcher.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6271/solr/core/src/java/org/apache/solr/search/SolrIndexSearcher.java?rev=1670384&r1=1670383&r2=1670384&view=diff
==============================================================================
--- lucene/dev/branches/lucene6271/solr/core/src/java/org/apache/solr/search/SolrIndexSearcher.java (original)
+++ lucene/dev/branches/lucene6271/solr/core/src/java/org/apache/solr/search/SolrIndexSearcher.java Tue Mar 31 16:38:50 2015
@@ -801,8 +801,6 @@ public class SolrIndexSearcher extends I
       return -1;
     }
     PostingsEnum docs = termsEnum.postings(leafReader.getLiveDocs(), null, PostingsEnum.NONE);
-    // nocommit: check
-    if (docs == null) return -1;
     int id = docs.nextDoc();
     return id == DocIdSetIterator.NO_MORE_DOCS ? -1 : id;
   }
@@ -1173,7 +1171,6 @@ public class SolrIndexSearcher extends I
     FixedBitSet fbs = null;
 
     PostingsEnum postingsEnum = deState.termsEnum.postings(deState.liveDocs, deState.postingsEnum, PostingsEnum.NONE);
-    // nocommit: check
     if (deState.postingsEnum == null) {
       deState.postingsEnum = postingsEnum;
     }