SOLR-9480: minor cleanup of nits found by sarowe

This commit is contained in:
Chris Hostetter 2018-05-22 10:41:51 -07:00
parent 5a47ed4209
commit f9091473e0
1 changed files with 9 additions and 11 deletions

View File

@ -137,7 +137,9 @@ public class RelatednessAgg extends AggValueSource {
} }
} }
return new SKGSlotAcc(fcontext, numSlots, fgFilters, bgQ); DocSet fgSet = fcontext.searcher.getDocSet(fgFilters);
DocSet bgSet = fcontext.searcher.getDocSet(bgQ);
return new SKGSlotAcc(fcontext, numSlots, fgSet, bgSet);
} }
@Override @Override
@ -151,15 +153,11 @@ public class RelatednessAgg extends AggValueSource {
private final DocSet bgSet; private final DocSet bgSet;
private final long fgSize; private final long fgSize;
private final long bgSize; private final long bgSize;
private final List<Query> fgFilters; public SKGSlotAcc(final FacetContext fcontext, final int numSlots,
private final Query bgQ; final DocSet fgSet, final DocSet bgSet) throws IOException {
public SKGSlotAcc(FacetContext fcontext, int numSlots,
List<Query> fgFilters, Query bgQ) throws IOException {
super(fcontext); super(fcontext);
this.fgFilters = fgFilters; this.fgSet = fgSet;
this.bgQ = bgQ; this.bgSet = bgSet;
this.fgSet = fcontext.searcher.getDocSet(fgFilters);
this.bgSet = fcontext.searcher.getDocSet(bgQ);
// cache the set sizes for frequent re-use on every slot // cache the set sizes for frequent re-use on every slot
this.fgSize = fgSet.size(); this.fgSize = fgSet.size();
this.bgSize = bgSet.size(); this.bgSize = bgSet.size();
@ -174,8 +172,8 @@ public class RelatednessAgg extends AggValueSource {
Query slotQ = slotContext.apply(slot).getSlotQuery(); Query slotQ = slotContext.apply(slot).getSlotQuery();
if (null == slotQ) { if (null == slotQ) {
// extremeley special edge case... // extremeley special edge case...
// the only way this should be possible is if our skg() function is used as a "top level" stat // the only way this should be possible is if our relatedness() function is used as a "top level"
// w/o being nested under any facet, in which case it should be a FacetQuery w/no parent... // stat w/o being nested under any facet, in which case it should be a FacetQuery w/no parent...
assert fcontext.processor.freq instanceof FacetQuery : fcontext.processor.freq; assert fcontext.processor.freq instanceof FacetQuery : fcontext.processor.freq;
assert null == fcontext.parent; assert null == fcontext.parent;
assert null == fcontext.filter; assert null == fcontext.filter;