Question

I need to facet inside n documents which are selected like

... ORDER BY something DESC LIMIT 100

Is that possible with Solr? How?

Was it helpful?

Solution

AFAIK no, that's not supported / implemented. Facets aren't really meant to be "stats" but a guidance to the end-user. Picture yourself browsing a faceted interface and seeing facets change whenever you change sort order or paging. Faceted browsing would be useless if it worked like that.

I think this would be a nice feature for the StatsComponent though.

OTHER TIPS

this is a total hack, but here goes...

  1. do your initial query, and get your results back.
  2. construct a new query, like so:

http://localhost:8080/solr/select/?q=id%3A123+OR+id%3A456...(keep OR-ing them up)...&facet=true&facet.field=something

where you concatenate all of your ids to a new query using OR. then, when you facet on your field, the facet summary will only apply to the results.

I think this is possible with results grouping (now in trunk!):

http://wiki.apache.org/solr/FieldCollapsing

... the only problem is that you can set only one 'facet.field' (i.e. group.field)

But the great thing is that you get scored facets!

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top