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

json.facet - prefix parameter doesn't work properly

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 5.3
    • 5.5.1, 5.6, 6.0
    • Facet Module
    • 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 }

      ]
      }
      }
      }

      Attachments

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

        Activity

          People

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

            Dates

              Created:
              Updated:
              Resolved: