mirror of https://github.com/apache/lucene.git
SOLR-11595: optimize SolrIndexSearcher.collectionStatistics
This commit is contained in:
parent
d77d54b1a6
commit
3923e9fba3
|
@ -123,6 +123,9 @@ Optimizations
|
|||
* SOLR-11641: Change `frange` to default to `cost=100` so default behavior is to PostFilter if user specifies
|
||||
`cache=false` (hossman)
|
||||
|
||||
* SOLR-11595: SolrIndexSearcher.localCollectionStatistics is now faster by leveraging an existing
|
||||
cached MultiFields. Noticeable when many fields are searched. (David Smiley)
|
||||
|
||||
Other Changes
|
||||
----------------------
|
||||
* SOLR-11478: Solr should remove itself from live_nodes in zk immediately on shutdown. (Cao Manh Dat)
|
||||
|
|
|
@ -367,7 +367,15 @@ public class SolrIndexSearcher extends IndexSearcher implements Closeable, SolrI
|
|||
}
|
||||
|
||||
public CollectionStatistics localCollectionStatistics(String field) throws IOException {
|
||||
return super.collectionStatistics(field);
|
||||
// Could call super.collectionStatistics(field); but we can use a cached MultiTerms
|
||||
assert field != null;
|
||||
// SlowAtomicReader has a cache of MultiTerms
|
||||
Terms terms = getSlowAtomicReader().terms(field);
|
||||
if (terms == null) {
|
||||
return null;
|
||||
}
|
||||
return new CollectionStatistics(field, reader.maxDoc(),
|
||||
terms.getDocCount(), terms.getSumTotalTermFreq(), terms.getSumDocFreq());
|
||||
}
|
||||
|
||||
public boolean isCachingEnabled() {
|
||||
|
|
Loading…
Reference in New Issue