Uploaded image for project: 'Lucene - Core'
  1. Lucene - Core
  2. LUCENE-7493

Support of TotalHitCountCollector for FacetCollector.search api if numdocs passed as zero.

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 6.3, 7.0
    • Component/s: None
    • Labels:
      None
    • Lucene Fields:
      New

      Description

      Hi,

      I want to do drill down search using FacetCollection below is the code

      FacetsCollector facetCollector = new FacetsCollector();
      TopDocs topDocs = FacetsCollector.search(st.searcher, filterQuery, limit, facetCollector);

      I just want facet information so I pass limit as zero but I get error "numHits must be > 0; please use TotalHitCountCollector if you just need the total hit count".

      For FacetCollector there is no way to initialize 'TotalHitCountCollector'. Internally it always create either 'TopFieldCollector' or 'TopScoreDocCollector' which does not allow limit as 0.

      So if limit should be zero then there should be a way that 'TotalHitCountCollector' should be initialized.

      Better way would be to provide an api which takes query and collector as inputs just like 'drillSideways.search(filterQuery, totalHitCountCollector)'.

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              maahi333 Mahesh
            • Votes:
              1 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: