Uploaded image for project: 'Solr'
  1. Solr
  2. SOLR-14764

optimize index-order sort for FacetFieldProcessorByArray

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Open
    • Minor
    • Resolution: Unresolved
    • 9.0
    • None
    • Facet Module
    • None

    Description

      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.

      Attachments

        Activity

          People

            Unassigned Unassigned
            magibney Michael Gibney
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:

              Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0h
                0h
                Logged:
                Time Spent - 1h 20m
                1h 20m