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

New MaxScoreQParserPlugin

    XMLWordPrintableJSON

Details

    • New Feature
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • None
    • 4.4, 6.0
    • query parsers
    • None

    Description

      A customer wants to contribute back this component.

      It is a QParser which behaves exactly like "lucene" parser (extends it), but returns the Max score from the clauses, i.e. max(c1,c2,c3..) instead of the default which is sum(c1,c2,c3...). It does this by wrapping all SHOULD clauses in a DisjunctionMaxQuery with tie=1.0. Any MUST or PROHIBITED clauses are passed through as-is. Non-boolean queries, e.g. NumericRange falls-through to "lucene" parser.

      To use, add to solrconfig.xml:

        <queryParser name="maxscore" class="solr.MaxScoreQParserPlugin"/>
      

      Then use it in a query

      q=A AND B AND {!maxscore v=$max}&max=C OR (D AND E)
      

      This will return the score of A+B+max(C,sum(D+E))

      Attachments

        1. SOLR-4785.patch
          11 kB
          Jan Høydahl
        2. SOLR-4785.patch
          11 kB
          Jan Høydahl
        3. SOLR-4785-Add-tests-for-maxscore-to-QueryEqualityTest.patch
          2 kB
          Greg Bowyer
        4. SOLR-4785-boostfix.patch
          3 kB
          Jan Høydahl

        Activity

          People

            janhoy Jan Høydahl
            janhoy Jan Høydahl
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: