Solr - Aggregate Term Frequency by Group

断了今生、忘了曾经 提交于 2020-01-05 05:39:07

问题


Let's say I have the following set of grouped websites crawled and indexed in Solr (latest) :

{
    "id":"1",
    "domain": "http://www.category1website1.com",
    "domainGroup": "Group 1"
},{
    "id":"2",
    "domain": "http://www.category1website2.com",
    "domainGroup": "Group 1"
},{
    "id":"3",
    "domain": "http://www.category2website1.com",
    "domainGroup": "Group 2"
}

I'm looking for a result set that will give me the term frequency in each individual domain but also the aggregated term frequency of that search term (aggregated by domainGroup).

Researching this has lead me to 3 possibilities:

  1. Can be done with Facet Pivot
  2. Can be done with Facet + Term Frequency Vectors
  3. Cannot be done

1 and 2 are different and I'm not sure which would work for me, or worse, neither via "option" 3.

Sorry if it's not clear. I'm trying to retrieve the frequency of the "search term" but I also need the frequency aggregated by domainGroup field. In other words I need to search ALL domains for "search term" in one request and retrieve the frequency of "search term" in NOT ONLY the individual domains (the default), but also the aggregated frequencies for all domainGroups (so the sum of term frequencies in all domains under the same domainGroup).


回答1:


I think the Facets with Term frequency Vectors is what you need. Try a query like this:

http://something/solr/select/?qt=tvrh&q=query:http://www.category2website1.com&tv.fl=query&tv.all=true&f.id.tv.tf=true&facet.field=domainGroup&facet=true&facet.limit=-1&facet.mincount=1


来源:https://stackoverflow.com/questions/17911960/solr-aggregate-term-frequency-by-group

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