SOLR-10399: Generalize some internal facet logic to simplify points/non-points field handling

This commit is contained in:
Chris Hostetter 2017-03-31 17:01:42 -07:00 committed by Shalin Shekhar Mangar
parent be2a1ea180
commit 62304383af
2 changed files with 5 additions and 11 deletions

View File

@ -184,6 +184,8 @@ Other Changes
* SOLR-10338: Configure SecureRandom non blocking for tests. (Mihaly Toth, hossman, Ishan Chattopadhyaya, via Mark Miller)
* SOLR-10399: Generalize some internal facet logic to simplify points/non-points field handling (Adrien Grand, hossman)
================== 6.5.0 ==================
Consult the LUCENE_CHANGES.txt file for additional, low level, changes in this release.

View File

@ -851,18 +851,10 @@ public class SimpleFacets {
SchemaField sf = searcher.getSchema().getField(field);
FieldType ft = sf.getType();
NamedList<Integer> res = new NamedList<>();
if (ft.isPointField()) {
for (String term : terms) {
int count = searcher.numDocs(ft.getFieldQuery(null, sf, term), parsed.docs);
res.add(term, count);
}
} else {
for (String term : terms) {
String internal = ft.toInternal(term);
int count = searcher.numDocs(new TermQuery(new Term(field, internal)), parsed.docs);
res.add(term, count);
}
}
return res;
}