LUCENE-6271: fix more nocommits in postings tests and solr uses

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/branches/lucene6271@1670384 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Ryan Ernst 2015-03-31 16:38:50 +00:00
parent ca6a9ca92a
commit 0f23c7ef49
4 changed files with 13 additions and 24 deletions

View File

@ -84,23 +84,19 @@ public class TestPostingsEnum extends LuceneTestCase {
// 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 LuceneTestCase {
// 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();

View File

@ -335,7 +335,6 @@ public class TermAutomatonQuery extends Query {
public EnumAndScorer(int termID, PostingsEnum posEnum) {
this.termID = termID;
// nocommit: check uses
this.posEnum = posEnum;
}
}

View File

@ -693,14 +693,11 @@ public class QueryElevationComponent extends SearchComponent implements SolrCore
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;
}
}
}

View File

@ -801,8 +801,6 @@ public class SolrIndexSearcher extends IndexSearcher implements Closeable,SolrIn
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 IndexSearcher implements Closeable,SolrIn
FixedBitSet fbs = null;
PostingsEnum postingsEnum = deState.termsEnum.postings(deState.liveDocs, deState.postingsEnum, PostingsEnum.NONE);
// nocommit: check
if (deState.postingsEnum == null) {
deState.postingsEnum = postingsEnum;
}