Skip to content

Commit

Permalink
feat: fixed explanation of scores for 2nd ord operator
Browse files Browse the repository at this point in the history
  • Loading branch information
romanchyla committed Dec 28, 2021
1 parent 82b1a58 commit 60d6d25
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1100,7 +1100,7 @@ public Query parse(FunctionQParser fp) throws SyntaxError {
}
});

// helper method; SOLR is not warming up caches when index is opened first time
// helper method; SOLR is not warming up caches when index is opened first time
// so we have to do it ourselves
parsers.put("warm_cache", new AqpSubqueryParserFull() {
@SuppressWarnings("unchecked")
Expand All @@ -1110,6 +1110,9 @@ public Query parse(FunctionQParser fp) throws SyntaxError {
@SuppressWarnings("rawtypes")
final CitationCache cache = (CitationCache) req.getSearcher().getCache("citations-cache");
if (!cache.isWarmingOrWarmed()) {
if (cache.size() > 0) {
return new MatchNoDocsQuery(); // we only allow it once (solr warms caches after first searcher was opened)
}
cache.warm(req.getSearcher(), cache);
}
return new MatchNoDocsQuery();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public String toString() {

@Override
public boolean needsScores() {
return topCollector.needsScores();
return this.topCollector.needsScores();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ public void extractTerms(Set<Term> terms) {

@Override
public Explanation explain(LeafReaderContext context, int doc) throws IOException {
return Explanation.match(0.0f, "nested, result of", innerWeight.explain(context, doc));
Explanation innerExplanation = innerWeight.explain(context, doc);
return Explanation.match(innerExplanation.getValue(), "nested, result of", innerExplanation);
}


Expand Down

0 comments on commit 60d6d25

Please sign in to comment.