Reputation: 2375
I using SOLR 4 and have a document schema that contains a multivalued field. The schema looks something like this:
... some fields
"foo": [
"aaa",
"abb",
"baa",
"bbb"
],
... more fields
I would like to get the count of all documents with each value of the "foo" variable:
To make things slightly more complicated, I would like to filter which facets are returned (in the above example, let's say only the ones beginning with "a"):
I think I need to filter the facets somehow but I'm at a loss how to begin. Suggestions welcome!
Upvotes: 3
Views: 3790
Reputation: 2077
I think field collapsing might be helpful:
https://cwiki.apache.org/confluence/display/solr/Result+Grouping
Upvotes: 0
Reputation: 2222
The facet.prefix parameter limits the terms on which to facet to those starting with the given string prefix.
q=*
&facet=true
&facet.field=foo
&facet.prefix=a
Above query will filter the facets and return you only those which starts with a.
Upvotes: 2