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

json.facet - prefix parameter doesn't work properly

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 5.3
    • Fix Version/s: 5.5.1, 5.6, 6.0
    • Component/s: Facet Module
    • Labels:
      None

      Description

      When using prefix in nested facets, not all values are found.
      In the following query, I use facet with prefix in both old way (facet.field) and new way (json.facet).
      In old way, I get 5 values. In new way I get only 3.

      This is the field definition in the schema:
      <field name="topics_f" type="string" indexed="true" stored="true" required="false" multiValued="true" />

      When I add to the schema docValues="true" the issue is solved.

      Query:

      http://localhost:8983/solr/mycore/select?q=*%3A*&rows=0&wt=json&indent=true&facet=true&facet.field=topics_f&facet.prefix=2&json.facet={trendFieldFacet:{type:terms,%20field:topics_f,%20%20prefix:%222%22%20}}

      Response:

      {
      "responseHeader": {
      "status": 0,
      "QTime": 0,
      "params": {
      "q": ":",
      "json.facet": "{trendFieldFacet:{type:terms, field:topics_f, prefix:\"2\" }}",
      "facet.field": "topics_f",
      "indent": "true",
      "facet.prefix": "2",
      "rows": "0",
      "wt": "json",
      "facet": "true",
      "_": "1444566142012"
      }
      },
      "response":

      { "numFound": 17, "start": 0, "docs": [] }

      ,
      "facet_counts": {
      "facet_queries": {},
      "facet_fields":

      { "topics_f": [ "2/device/iphone", 4, "2/device/samsung", 4, "2/city/london", 1, "2/city/rome", 1, "2/device/other", 1 ] }

      ,
      "facet_dates": {},
      "facet_ranges": {},
      "facet_intervals": {},
      "facet_heatmaps": {}
      },
      "facets": {
      "count": 17,
      "trendFieldFacet": {
      "buckets": [

      { "val": "2/device/iphone", "count": 4 }

      ,

      { "val": "2/device/samsung", "count": 4 }

      ,

      { "val": "2/device/other", "count": 1 }

      ]
      }
      }
      }

      1. SOLR-8155.patch
        7 kB
        Yonik Seeley
      2. SOLR-8155.patch
        4 kB
        Mikhail Khludnev

        Activity

        Hide
        mkhludnev Mikhail Khludnev added a comment -

        I think I see it while working on SOLR-8466. There is a testcase for older facets, which reproduces the issue. I'm going to port it for json.facets.

        Show
        mkhludnev Mikhail Khludnev added a comment - I think I see it while working on SOLR-8466 . There is a testcase for older facets, which reproduces the issue. I'm going to port it for json.facets.
        Hide
        mkhludnev Mikhail Khludnev added a comment -

        attaching a failing test SOLR-8155.patch

        Show
        mkhludnev Mikhail Khludnev added a comment - attaching a failing test SOLR-8155.patch
        Hide
        yseeley@gmail.com Yonik Seeley added a comment -

        OK, so there was a bug in the generic accumulation code used when there was a facet prefix or when a bucket sort other than count was used.
        This patch fixes the bug and re-enables facet.prefix when facet.method=uif (SOLR-8466) and enables the test code for that as well.

        Show
        yseeley@gmail.com Yonik Seeley added a comment - OK, so there was a bug in the generic accumulation code used when there was a facet prefix or when a bucket sort other than count was used. This patch fixes the bug and re-enables facet.prefix when facet.method=uif ( SOLR-8466 ) and enables the test code for that as well.
        Hide
        jira-bot ASF subversion and git services added a comment -

        Commit 85557261431f9314253ebe282eb6d400bf7cae03 in lucene-solr's branch refs/heads/master from Yonik Seeley
        [ https://git-wip-us.apache.org/repos/asf?p=lucene-solr.git;h=8555726 ]

        SOLR-8155: fix UnInvertedField.collectDocsGeneric, used for facet.prefix or non-count sorting

        Show
        jira-bot ASF subversion and git services added a comment - Commit 85557261431f9314253ebe282eb6d400bf7cae03 in lucene-solr's branch refs/heads/master from Yonik Seeley [ https://git-wip-us.apache.org/repos/asf?p=lucene-solr.git;h=8555726 ] SOLR-8155 : fix UnInvertedField.collectDocsGeneric, used for facet.prefix or non-count sorting
        Hide
        jira-bot ASF subversion and git services added a comment -

        Commit 4d5a33e9ba2cdd40ef1ff0230deae895fa517279 in lucene-solr's branch refs/heads/branch_6x from Yonik Seeley
        [ https://git-wip-us.apache.org/repos/asf?p=lucene-solr.git;h=4d5a33e ]

        SOLR-8155: fix UnInvertedField.collectDocsGeneric, used for facet.prefix or non-count sorting

        Show
        jira-bot ASF subversion and git services added a comment - Commit 4d5a33e9ba2cdd40ef1ff0230deae895fa517279 in lucene-solr's branch refs/heads/branch_6x from Yonik Seeley [ https://git-wip-us.apache.org/repos/asf?p=lucene-solr.git;h=4d5a33e ] SOLR-8155 : fix UnInvertedField.collectDocsGeneric, used for facet.prefix or non-count sorting
        Hide
        jira-bot ASF subversion and git services added a comment -

        Commit 1b332b1da5fa490a541ea46823c6681501549113 in lucene-solr's branch refs/heads/branch_6_0 from Yonik Seeley
        [ https://git-wip-us.apache.org/repos/asf?p=lucene-solr.git;h=1b332b1 ]

        SOLR-8155: fix UnInvertedField.collectDocsGeneric, used for facet.prefix or non-count sorting

        Show
        jira-bot ASF subversion and git services added a comment - Commit 1b332b1da5fa490a541ea46823c6681501549113 in lucene-solr's branch refs/heads/branch_6_0 from Yonik Seeley [ https://git-wip-us.apache.org/repos/asf?p=lucene-solr.git;h=1b332b1 ] SOLR-8155 : fix UnInvertedField.collectDocsGeneric, used for facet.prefix or non-count sorting
        Hide
        yseeley@gmail.com Yonik Seeley added a comment -

        OK, this fix will be in 6.0
        If we have a future 5.x release, we should backport at that time.

        Show
        yseeley@gmail.com Yonik Seeley added a comment - OK, this fix will be in 6.0 If we have a future 5.x release, we should backport at that time.
        Hide
        jira-bot ASF subversion and git services added a comment -

        Commit 0073ba9700d5df7b00d77a5d5dd831316f138042 in lucene-solr's branch refs/heads/branch_5x from Yonik Seeley
        [ https://git-wip-us.apache.org/repos/asf?p=lucene-solr.git;h=0073ba9 ]

        SOLR-8155: fix UnInvertedField.collectDocsGeneric, used for facet.prefix or non-count sorting

        Show
        jira-bot ASF subversion and git services added a comment - Commit 0073ba9700d5df7b00d77a5d5dd831316f138042 in lucene-solr's branch refs/heads/branch_5x from Yonik Seeley [ https://git-wip-us.apache.org/repos/asf?p=lucene-solr.git;h=0073ba9 ] SOLR-8155 : fix UnInvertedField.collectDocsGeneric, used for facet.prefix or non-count sorting
        Hide
        jira-bot ASF subversion and git services added a comment -

        Commit c3446734a2b6dccd8092f5672651779223076dac in lucene-solr's branch refs/heads/branch_5_5 from Yonik Seeley
        [ https://git-wip-us.apache.org/repos/asf?p=lucene-solr.git;h=c344673 ]

        SOLR-8155: fix UnInvertedField.collectDocsGeneric, used for facet.prefix or non-count sorting

        Show
        jira-bot ASF subversion and git services added a comment - Commit c3446734a2b6dccd8092f5672651779223076dac in lucene-solr's branch refs/heads/branch_5_5 from Yonik Seeley [ https://git-wip-us.apache.org/repos/asf?p=lucene-solr.git;h=c344673 ] SOLR-8155 : fix UnInvertedField.collectDocsGeneric, used for facet.prefix or non-count sorting

          People

          • Assignee:
            yseeley@gmail.com Yonik Seeley
            Reporter:
            yonesher Yosi Nesher
          • Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development