How to filter results based on order in Solr?

我是研究僧i 提交于 2019-12-11 03:29:19

问题


I need to facet inside n documents which are selected like

... ORDER BY something DESC LIMIT 100

Is that possible with Solr? How?


回答1:


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.




回答2:


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.




回答3:


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!



来源:https://stackoverflow.com/questions/1997783/how-to-filter-results-based-on-order-in-solr

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!