mirror of https://github.com/apache/lucene.git
SOLR-10836: igain, significantTerms, and tlogit assumed existing terms
This commit is contained in:
parent
566fcfce13
commit
5c781d5679
|
@ -350,6 +350,11 @@ Bug Fixes
|
||||||
|
|
||||||
* SOLR-10829: Fixed IndexSchema to enforce that uniqueKey can not be Points based for correctness (hossman)
|
* SOLR-10829: Fixed IndexSchema to enforce that uniqueKey can not be Points based for correctness (hossman)
|
||||||
|
|
||||||
|
* SOLR-10836: The query parsers igain, significantTerms, and tlogit (used by streaming expressions by
|
||||||
|
the same name) might throw a NullPointerException if the referenced field had no indexed data in some
|
||||||
|
shards. The fix included an optimization to use Solr's cached AtomicReader instead of re-calculating.
|
||||||
|
(David Smiley)
|
||||||
|
|
||||||
Optimizations
|
Optimizations
|
||||||
----------------------
|
----------------------
|
||||||
* SOLR-10634: JSON Facet API: When a field/terms facet will retrieve all buckets (i.e. limit:-1)
|
* SOLR-10634: JSON Facet API: When a field/terms facet will retrieve all buckets (i.e. limit:-1)
|
||||||
|
|
|
@ -23,7 +23,6 @@ import java.util.TreeSet;
|
||||||
|
|
||||||
import org.apache.lucene.index.LeafReader;
|
import org.apache.lucene.index.LeafReader;
|
||||||
import org.apache.lucene.index.LeafReaderContext;
|
import org.apache.lucene.index.LeafReaderContext;
|
||||||
import org.apache.lucene.index.MultiFields;
|
|
||||||
import org.apache.lucene.index.NumericDocValues;
|
import org.apache.lucene.index.NumericDocValues;
|
||||||
import org.apache.lucene.index.PostingsEnum;
|
import org.apache.lucene.index.PostingsEnum;
|
||||||
import org.apache.lucene.index.Terms;
|
import org.apache.lucene.index.Terms;
|
||||||
|
@ -162,8 +161,8 @@ public class IGainTermsQParserPlugin extends QParserPlugin {
|
||||||
double pc = numPositiveDocs / numDocs;
|
double pc = numPositiveDocs / numDocs;
|
||||||
double entropyC = binaryEntropy(pc);
|
double entropyC = binaryEntropy(pc);
|
||||||
|
|
||||||
Terms terms = MultiFields.getFields(searcher.getIndexReader()).terms(field);
|
Terms terms = ((SolrIndexSearcher)searcher).getSlowAtomicReader().terms(field);
|
||||||
TermsEnum termsEnum = terms.iterator();
|
TermsEnum termsEnum = terms == null ? TermsEnum.EMPTY : terms.iterator();
|
||||||
BytesRef term;
|
BytesRef term;
|
||||||
PostingsEnum postingsEnum = null;
|
PostingsEnum postingsEnum = null;
|
||||||
while ((term = termsEnum.next()) != null) {
|
while ((term = termsEnum.next()) != null) {
|
||||||
|
|
|
@ -19,12 +19,11 @@ package org.apache.solr.search;
|
||||||
|
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.TreeSet;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.TreeSet;
|
||||||
|
|
||||||
import org.apache.lucene.index.LeafReaderContext;
|
import org.apache.lucene.index.LeafReaderContext;
|
||||||
import org.apache.lucene.index.MultiFields;
|
|
||||||
import org.apache.lucene.index.PostingsEnum;
|
import org.apache.lucene.index.PostingsEnum;
|
||||||
import org.apache.lucene.index.Terms;
|
import org.apache.lucene.index.Terms;
|
||||||
import org.apache.lucene.index.TermsEnum;
|
import org.apache.lucene.index.TermsEnum;
|
||||||
|
@ -146,8 +145,8 @@ public class SignificantTermsQParserPlugin extends QParserPlugin {
|
||||||
//TODO: Use a priority queue
|
//TODO: Use a priority queue
|
||||||
TreeSet<TermWithScore> topTerms = new TreeSet<>();
|
TreeSet<TermWithScore> topTerms = new TreeSet<>();
|
||||||
|
|
||||||
Terms terms = MultiFields.getFields(searcher.getIndexReader()).terms(field);
|
Terms terms = ((SolrIndexSearcher)searcher).getSlowAtomicReader().terms(field);
|
||||||
TermsEnum termsEnum = terms.iterator();
|
TermsEnum termsEnum = terms == null ? TermsEnum.EMPTY : terms.iterator();
|
||||||
BytesRef term;
|
BytesRef term;
|
||||||
PostingsEnum postingsEnum = null;
|
PostingsEnum postingsEnum = null;
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,6 @@ import java.util.Map;
|
||||||
|
|
||||||
import org.apache.lucene.index.LeafReader;
|
import org.apache.lucene.index.LeafReader;
|
||||||
import org.apache.lucene.index.LeafReaderContext;
|
import org.apache.lucene.index.LeafReaderContext;
|
||||||
import org.apache.lucene.index.MultiFields;
|
|
||||||
import org.apache.lucene.index.NumericDocValues;
|
import org.apache.lucene.index.NumericDocValues;
|
||||||
import org.apache.lucene.index.PostingsEnum;
|
import org.apache.lucene.index.PostingsEnum;
|
||||||
import org.apache.lucene.index.Terms;
|
import org.apache.lucene.index.Terms;
|
||||||
|
@ -173,8 +172,8 @@ public class TextLogisticRegressionQParserPlugin extends QParserPlugin {
|
||||||
public void finish() throws IOException {
|
public void finish() throws IOException {
|
||||||
|
|
||||||
Map<Integer, double[]> docVectors = new HashMap<>();
|
Map<Integer, double[]> docVectors = new HashMap<>();
|
||||||
Terms terms = MultiFields.getFields(searcher.getIndexReader()).terms(trainingParams.feature);
|
Terms terms = ((SolrIndexSearcher)searcher).getSlowAtomicReader().terms(trainingParams.feature);
|
||||||
TermsEnum termsEnum = terms.iterator();
|
TermsEnum termsEnum = terms == null ? TermsEnum.EMPTY : terms.iterator();
|
||||||
PostingsEnum postingsEnum = null;
|
PostingsEnum postingsEnum = null;
|
||||||
int termIndex = 0;
|
int termIndex = 0;
|
||||||
for (String termStr : trainingParams.terms) {
|
for (String termStr : trainingParams.terms) {
|
||||||
|
|
Loading…
Reference in New Issue