diff --git a/contrib/adsabs/src/java/org/apache/lucene/queryparser/flexible/aqp/builders/AqpAdsabsSubQueryProvider.java b/contrib/adsabs/src/java/org/apache/lucene/queryparser/flexible/aqp/builders/AqpAdsabsSubQueryProvider.java index 70a190455..dd97515fd 100644 --- a/contrib/adsabs/src/java/org/apache/lucene/queryparser/flexible/aqp/builders/AqpAdsabsSubQueryProvider.java +++ b/contrib/adsabs/src/java/org/apache/lucene/queryparser/flexible/aqp/builders/AqpAdsabsSubQueryProvider.java @@ -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") @@ -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(); diff --git a/contrib/adsabs/src/java/org/apache/lucene/search/SecondOrderCollectorTopN.java b/contrib/adsabs/src/java/org/apache/lucene/search/SecondOrderCollectorTopN.java index 4d66e1d82..4e76b57ba 100644 --- a/contrib/adsabs/src/java/org/apache/lucene/search/SecondOrderCollectorTopN.java +++ b/contrib/adsabs/src/java/org/apache/lucene/search/SecondOrderCollectorTopN.java @@ -57,7 +57,7 @@ public String toString() { @Override public boolean needsScores() { - return topCollector.needsScores(); + return this.topCollector.needsScores(); } @Override diff --git a/contrib/adsabs/src/java/org/apache/lucene/search/SecondOrderWeight.java b/contrib/adsabs/src/java/org/apache/lucene/search/SecondOrderWeight.java index 616940f51..eab2fd6e4 100644 --- a/contrib/adsabs/src/java/org/apache/lucene/search/SecondOrderWeight.java +++ b/contrib/adsabs/src/java/org/apache/lucene/search/SecondOrderWeight.java @@ -38,7 +38,8 @@ public void extractTerms(Set 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); }