views:

337

answers:

3

I need to facet inside n documents which are selected like

... ORDER BY something DESC LIMIT 100

Is that possible with Solr? How?

A: 

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.

Mauricio Scheffer
Yup, I agree, that would be nice feature, along with percentile calculation.
JouMaN
+1  A: 

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.

ryancammer
Well, yes, but this ain't that good solution for example to get top 10000 :)
JouMaN
hey man like i said it's total hackery.
ryancammer