Solr
  1. Solr
  2. SOLR-5536

Add ValueSource collapse criteria to CollapsingQParsingPlugin

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 4.6
    • Fix Version/s: 4.7, 5.0
    • Component/s: search
    • Labels:
      None

      Description

      It would be useful for the CollapsingQParserPlugin to support ValueSource collapse criteria.

      Proposed syntax:

      fq={!collapse field=collapse_field max=value_source}
      

      This ticket will also introduce a function query called "cscore", which will return the score of the current document being collapsed. This will allow score to be incorporated into collapse criteria functions.

      A simple example of the cscore usage:

      fq={!collapse field=collapse_field max=sum(cscore(), field(x))}
      
      1. SOLR-5536.patch
        8 kB
        Joel Bernstein
      2. SOLR-5536.patch
        14 kB
        Joel Bernstein
      3. SOLR-5536.patch
        15 kB
        Joel Bernstein
      4. SOLR-5536.patch
        15 kB
        Joel Bernstein
      5. SOLR-5536-edited.patch
        15 kB
        Peter Keegan

        Activity

        Hide
        Joel Bernstein added a comment -

        Initial patch

        Show
        Joel Bernstein added a comment - Initial patch
        Hide
        Joel Bernstein added a comment -

        Initial patch, generated from trunk, adds the ValueSource collapse criteria to the CollapsingQParserPlugin.

        The collapseScore function query is not yet included.

        Show
        Joel Bernstein added a comment - Initial patch, generated from trunk, adds the ValueSource collapse criteria to the CollapsingQParserPlugin. The collapseScore function query is not yet included.
        Hide
        Joel Bernstein added a comment - - edited

        New patch generated from latest trunk. Patch has full working implementation including the cscore function query as well as basic tests. All tests passing.

        Show
        Joel Bernstein added a comment - - edited New patch generated from latest trunk. Patch has full working implementation including the cscore function query as well as basic tests. All tests passing.
        Hide
        Joel Bernstein added a comment -

        Added header to a class, so this patch passes precommit.

        Show
        Joel Bernstein added a comment - Added header to a class, so this patch passes precommit.
        Hide
        Joel Bernstein added a comment - - edited

        Added compound function test with cscore:

        sum(cscore(),field(x))
        Show
        Joel Bernstein added a comment - - edited Added compound function test with cscore: sum(cscore(),field(x))
        Hide
        ASF subversion and git services added a comment -

        Commit 1554523 from Joel Bernstein in branch 'dev/trunk'
        [ https://svn.apache.org/r1554523 ]

        SOLR-5536: Add ValueSource collapse criteria to CollapsingQParserPlugin

        Show
        ASF subversion and git services added a comment - Commit 1554523 from Joel Bernstein in branch 'dev/trunk' [ https://svn.apache.org/r1554523 ] SOLR-5536 : Add ValueSource collapse criteria to CollapsingQParserPlugin
        Hide
        ASF subversion and git services added a comment -

        Commit 1554537 from Joel Bernstein in branch 'dev/branches/branch_4x'
        [ https://svn.apache.org/r1554537 ]

        SOLR-5536: Add ValueSource collapse criteria to CollapsingQParserPlugin

        Show
        ASF subversion and git services added a comment - Commit 1554537 from Joel Bernstein in branch 'dev/branches/branch_4x' [ https://svn.apache.org/r1554537 ] SOLR-5536 : Add ValueSource collapse criteria to CollapsingQParserPlugin
        Hide
        ASF subversion and git services added a comment -

        Commit 1566754 from Joel Bernstein in branch 'dev/trunk'
        [ https://svn.apache.org/r1566754 ]

        SOLR-5536: Added a proper ValueSource context

        Show
        ASF subversion and git services added a comment - Commit 1566754 from Joel Bernstein in branch 'dev/trunk' [ https://svn.apache.org/r1566754 ] SOLR-5536 : Added a proper ValueSource context
        Hide
        ASF subversion and git services added a comment -

        Commit 1566844 from Joel Bernstein in branch 'dev/branches/branch_4x'
        [ https://svn.apache.org/r1566844 ]

        SOLR-5536: Added a proper ValueSource context

        Show
        ASF subversion and git services added a comment - Commit 1566844 from Joel Bernstein in branch 'dev/branches/branch_4x' [ https://svn.apache.org/r1566844 ] SOLR-5536 : Added a proper ValueSource context
        Hide
        Peter Keegan added a comment -

        I wasn't able to install the latest patch because of some extraneous lines. I've uploaded a version that works for me. Also, it looks like the tests got dropped.

        Thanks,
        Peter

        Show
        Peter Keegan added a comment - I wasn't able to install the latest patch because of some extraneous lines. I've uploaded a version that works for me. Also, it looks like the tests got dropped. Thanks, Peter
        Hide
        Peter Keegan added a comment -

        Correction: there's a test in the patch, but I see these extra lines at the end of the patch file:

        //Test collapse by score with elevation

        params = new ModifiableSolrParams();

        Show
        Peter Keegan added a comment - Correction: there's a test in the patch, but I see these extra lines at the end of the patch file: //Test collapse by score with elevation params = new ModifiableSolrParams();
        Hide
        Joel Bernstein added a comment -

        Hi Peter,

        There were a couple of jiras for the CollapsingQParserPlugin being worked on at once while this ticket was being developed. So the patch here likely built upon changes committed on other tickets. So it's best to look at the commits that were done in svn for the CollapsingQParserPlugin and merge them in order into your branch.

        Joel

        Show
        Joel Bernstein added a comment - Hi Peter, There were a couple of jiras for the CollapsingQParserPlugin being worked on at once while this ticket was being developed. So the patch here likely built upon changes committed on other tickets. So it's best to look at the commits that were done in svn for the CollapsingQParserPlugin and merge them in order into your branch. Joel
        Hide
        Peter Keegan added a comment -

        Hi Joel,

        The patch worked fine with 4.6.1 after I removed the 'bad' lines (Eclipse patch tool is rather fussy):

        $ diff SOLR-5536.patch SOLR-5536-edited.patch
        324,331d323
        < \ No newline at end of file
        <
        < Property changes on: solr/core/src/java/org/apache/solr/search/function/CollapseScoreFunction.java
        < ___________________________________________________________________
        < Added: svn:eol-style
        < ## -0,0 +1 ##
        < +native
        < \ No newline at end of property
        391,393c383
        < //Test collapse by score with elevation
        <
        < params = new ModifiableSolrParams();

        Thanks,
        Peter

        Show
        Peter Keegan added a comment - Hi Joel, The patch worked fine with 4.6.1 after I removed the 'bad' lines (Eclipse patch tool is rather fussy): $ diff SOLR-5536 .patch SOLR-5536 -edited.patch 324,331d323 < \ No newline at end of file < < Property changes on: solr/core/src/java/org/apache/solr/search/function/CollapseScoreFunction.java < ___________________________________________________________________ < Added: svn:eol-style < ## -0,0 +1 ## < +native < \ No newline at end of property 391,393c383 < //Test collapse by score with elevation < < params = new ModifiableSolrParams(); Thanks, Peter

          People

          • Assignee:
            Joel Bernstein
            Reporter:
            Joel Bernstein
          • Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development