Hi,

Is there any way to reference the 'val' value of a bucket in the JSON facet API? I have a set of records that all have collection tags. I want to facet on those collections and sort them by a function that uses the number of search documents in that collection and the total number of index documents in that collection. The first is just 'count', and the second is 'docfreq(collections_sm,val)', but I can't seem to access the 'val' value. I can't get that value from the document fields as the collection tag field is multivalued and some collections overlap. Any ideas?

Example query:

q=test&json.facet={collections: { type: terms, field: collections_sm}}

Response:

..."facets":{
    "count":78,
    "collections":{
      "buckets":[{
          "val":"Ephemera",
          "count":10},
        {
          "val":"Educational Ephemera",
          "count":5}, ...

Query I want to get working:

q=test&json.facet={
                    collections:{
                      type: terms,
                      field: collections_sm,
                      sort: {s: asc},
                      facet:{
                        s:"div(docfreq(collections_sm,val),count)"
                      }
                    }
                  }

Thanks,

Mel

Reply via email to