mirror of https://github.com/apache/lucene.git
SOLR-4877, LUCENE-5023: Removed SolrIndexSearcher#getDocSetNC()'s special case for handling TermQuery to prevent NullPointerException if reader does not have fields
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1487914 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
2c1af23df7
commit
fecb6fb0a2
|
@ -212,6 +212,10 @@ Bug Fixes
|
|||
* SOLR-4870: RecentUpdates.update() does not increment numUpdates loop counter
|
||||
(Alexey Kudinov via shalin)
|
||||
|
||||
* SOLR-4877, LUCENE-5023: Removed SolrIndexSearcher#getDocSetNC()'s special
|
||||
case for handling TermQuery to prevent NullPointerException if reader does
|
||||
not have fields. (Bao Yang Yang, Uwe Schindler)
|
||||
|
||||
Other Changes
|
||||
----------------------
|
||||
|
||||
|
|
|
@ -1095,41 +1095,12 @@ public class SolrIndexSearcher extends IndexSearcher implements Closeable,SolrIn
|
|||
DocSetCollector collector = new DocSetCollector(maxDoc()>>6, maxDoc());
|
||||
|
||||
if (filter==null) {
|
||||
if (query instanceof TermQuery) {
|
||||
Term t = ((TermQuery)query).getTerm();
|
||||
for (final AtomicReaderContext leaf : leafContexts) {
|
||||
final AtomicReader reader = leaf.reader();
|
||||
collector.setNextReader(leaf);
|
||||
Fields fields = reader.fields();
|
||||
Terms terms = fields.terms(t.field());
|
||||
BytesRef termBytes = t.bytes();
|
||||
|
||||
Bits liveDocs = reader.getLiveDocs();
|
||||
DocsEnum docsEnum = null;
|
||||
if (terms != null) {
|
||||
final TermsEnum termsEnum = terms.iterator(null);
|
||||
if (termsEnum.seekExact(termBytes, false)) {
|
||||
docsEnum = termsEnum.docs(liveDocs, null, DocsEnum.FLAG_NONE);
|
||||
}
|
||||
}
|
||||
|
||||
if (docsEnum != null) {
|
||||
int docid;
|
||||
while ((docid = docsEnum.nextDoc()) != DocIdSetIterator.NO_MORE_DOCS) {
|
||||
collector.collect(docid);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
super.search(query,null,collector);
|
||||
}
|
||||
return collector.getDocSet();
|
||||
|
||||
super.search(query,null,collector);
|
||||
} else {
|
||||
Filter luceneFilter = filter.getTopFilter();
|
||||
super.search(query, luceneFilter, collector);
|
||||
return collector.getDocSet();
|
||||
}
|
||||
return collector.getDocSet();
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue