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

Pluggable Ranking Collectors and Merge Strategies

    Details

    • Type: New Feature
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 4.9
    • Component/s: search
    • Labels:
      None

      Description

      This ticket introduces a new RankQuery and MergeStrategy to Solr. By extending the RankQuery class, and implementing it's interface, you can specify a custom ranking collector (TopDocsCollector) and distributed merge strategy for a Solr query.

      Sample syntax:

      q=hello&rq={!customRank param1=a param2=b}&wt=json&indent=true
      

      In the sample above the new "rq" (rank query) param:

      rq={!customRank  param1=a param2=b}

      points to a QParserPlugin that returns a Query that extends RankQuery. The RankQuery defines the custom ranking and merge strategy for the main query.

      The RankQuery impl will have to do several things:

      1) Implement the getTopDocsCollector() method to return a custom top docs ranking collector.
      2) Implement the wrap() method. The QueryComponent calls the wrap() method to wrap the RankQuery around the main query. This design allows the RankQuery to manage Query caching issues and implement custom Query explanations if needed.
      3) Implement hashCode() and equals() so the queryResultCache works properly with main query and custom ranking algorithm.
      4) Optionally implement a custom MergeStrategy to handle the merging of distributed results from the shards.

        Attachments

        1. SOLR-5973.patch
          7 kB
          Joel Bernstein
        2. SOLR-5973.patch
          72 kB
          Joel Bernstein
        3. SOLR-5973.patch
          72 kB
          Joel Bernstein
        4. SOLR-5973.patch
          72 kB
          Joel Bernstein
        5. SOLR-5973.patch
          69 kB
          Joel Bernstein
        6. SOLR-5973.patch
          67 kB
          Joel Bernstein
        7. SOLR-5973.patch
          66 kB
          Joel Bernstein
        8. SOLR-5973.patch
          63 kB
          Joel Bernstein
        9. SOLR-5973.patch
          55 kB
          Joel Bernstein
        10. SOLR-5973.patch
          55 kB
          Joel Bernstein
        11. SOLR-5973.patch
          45 kB
          Joel Bernstein
        12. SOLR-5973.patch
          43 kB
          Joel Bernstein
        13. SOLR-5973.patch
          41 kB
          Joel Bernstein
        14. SOLR-5973.patch
          38 kB
          Joel Bernstein
        15. SOLR-5973.patch
          7 kB
          Joel Bernstein
        16. SOLR-5973.patch
          5 kB
          Joel Bernstein

          Issue Links

            Activity

              People

              • Assignee:
                joel.bernstein Joel Bernstein
                Reporter:
                joel.bernstein Joel Bernstein
              • Votes:
                1 Vote for this issue
                Watchers:
                13 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: