Michael Gibney created SOLR-14764:
-------------------------------------
Summary: optimize index-order sort for FacetFieldProcessorByArray
Key: SOLR-14764
URL: https://issues.apache.org/jira/browse/SOLR-14764
Project: Solr
Issue Type: Improvement
Components: Facet Module
Affects Versions: master (9.0)
Reporter: Michael Gibney
{{FacetFieldProcessorByArray}} (DV and UIF) each accumulate term facet counts
into an array that directly corresponds to term ords (and is thus already
sorted in index order). When facets are returned sorted in index-order (asc or
desc), sorting to find return values can be shortcircuited once enough facet
values have been found to return.
The performance gains are greatest for high-recall domain faceting over
high-cardinality fields. Currently, iteration always goes from 0 to {{nTerms}},
so the case most negatively affected is "sort=index desc" -- every term ord is
currently visited (the case for "asc" as well), and is passed through the
topTerms PriorityQueue essentially as if it were a FIFO queue (accordingly, for
high-recall, high-cardinality cases, "index desc" performs far less well than
"index asc").
By shortcircuiting "index asc" once enough terms have been collected, and by
reversing the iteration direction for "index desc" and likewise
shortcircuiting, a clear performance gain can be straightforwardly achieved.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]