Apache Lucene open-source search software
LUCENE-6271: fix more nocommits in postings tests and solr uses
Ryan Ernst0f23c7ef4921
diff --git a/lucene/core/src/test/org/apache/lucene/index/TestPostingsEnum.java b/lucene/core/src/test/org/apache/lucene/index/TestPostingsEnum.javaindex eb5bddaca44..05c99bfe3d0 100644--- a/lucene/core/src/test/org/apache/lucene/index/TestPostingsEnum.java+++ b/lucene/core/src/test/org/apache/lucene/index/TestPostingsEnum.java@@ -84,23 +84,19 @@ public class TestPostingsEnum extends LuceneTestCase {// we did not index positionsPostingsEnum docsAndPositionsEnum = getOnlySegmentReader(reader).postings(new Term("foo", "bar"), PostingsEnum.POSITIONS);- // nocommit: check- assertNull(docsAndPositionsEnum);+ assertNotNull(docsAndPositionsEnum);// we did not index positionsdocsAndPositionsEnum = getOnlySegmentReader(reader).postings(new Term("foo", "bar"), PostingsEnum.PAYLOADS);- // nocommit: check- assertNull(docsAndPositionsEnum);+ assertNotNull(docsAndPositionsEnum);// we did not index positionsdocsAndPositionsEnum = getOnlySegmentReader(reader).postings(new Term("foo", "bar"), PostingsEnum.OFFSETS);- // nocommit: check- assertNull(docsAndPositionsEnum);+ assertNotNull(docsAndPositionsEnum);// we did not index positionsdocsAndPositionsEnum = 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 LuceneTestCase {// we did not index positionsPostingsEnum docsAndPositionsEnum = getOnlySegmentReader(reader).postings(new Term("foo", "bar"), PostingsEnum.POSITIONS);- assertNull(docsAndPositionsEnum);+ assertNotNull(docsAndPositionsEnum);// we did not index positionsdocsAndPositionsEnum = getOnlySegmentReader(reader).postings(new Term("foo", "bar"), PostingsEnum.PAYLOADS);- assertNull(docsAndPositionsEnum);+ assertNotNull(docsAndPositionsEnum);// we did not index positionsdocsAndPositionsEnum = getOnlySegmentReader(reader).postings(new Term("foo", "bar"), PostingsEnum.OFFSETS);- assertNull(docsAndPositionsEnum);+ assertNotNull(docsAndPositionsEnum);// we did not index positionsdocsAndPositionsEnum = getOnlySegmentReader(reader).postings(new Term("foo", "bar"), PostingsEnum.ALL);- assertNull(docsAndPositionsEnum);+ assertNotNull(docsAndPositionsEnum);iw.close();reader.close();diff --git a/lucene/sandbox/src/java/org/apache/lucene/search/TermAutomatonQuery.java b/lucene/sandbox/src/java/org/apache/lucene/search/TermAutomatonQuery.javaindex 49691129423..b52cd159367 100644--- a/lucene/sandbox/src/java/org/apache/lucene/search/TermAutomatonQuery.java+++ b/lucene/sandbox/src/java/org/apache/lucene/search/TermAutomatonQuery.java@@ -335,7 +335,6 @@ public class TermAutomatonQuery extends Query {public EnumAndScorer(int termID, PostingsEnum posEnum) {this.termID = termID;- // nocommit: check usesthis.posEnum = posEnum;}}diff --git a/solr/core/src/java/org/apache/solr/handler/component/QueryElevationComponent.java b/solr/core/src/java/org/apache/solr/handler/component/QueryElevationComponent.javaindex 77bc0d636af..8c1226568f3 100644--- a/solr/core/src/java/org/apache/solr/handler/component/QueryElevationComponent.java+++ b/solr/core/src/java/org/apache/solr/handler/component/QueryElevationComponent.java@@ -693,14 +693,11 @@ public class QueryElevationComponent extends SearchComponent implements SolrCoreterm.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;}}}diff --git a/solr/core/src/java/org/apache/solr/search/SolrIndexSearcher.java b/solr/core/src/java/org/apache/solr/search/SolrIndexSearcher.javaindex 6e127bcc55c..2164db47bde 100644--- a/solr/core/src/java/org/apache/solr/search/SolrIndexSearcher.java+++ b/solr/core/src/java/org/apache/solr/search/SolrIndexSearcher.java@@ -801,8 +801,6 @@ public class SolrIndexSearcher extends IndexSearcher implements Closeable,SolrInreturn -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 IndexSearcher implements Closeable,SolrInFixedBitSet fbs = null;PostingsEnum postingsEnum = deState.termsEnum.postings(deState.liveDocs, deState.postingsEnum, PostingsEnum.NONE);- // nocommit: checkif (deState.postingsEnum == null) {deState.postingsEnum = postingsEnum;}