solr更改查询结果

Solr change query result

我的管理架构中有下一个字段

  <field name="title" type="string" indexed="true" stored="true"/>  
  <field name="body" type="text_general" indexed="true" stored="true"/>
  <field name="url" type="string" uninvertible="true" indexed="true" stored="true"/>

我还使用带有可选 boost (qf=body^2 title^100) 选项的查询字段的 edismax。

我有很多来自不同域的 url,例如:

http://domain1.com/
http://domain1.com/aaa
http://domain1.com/aaa/bbb
http://domain1.com/aaa/bbb2
http://domain1.com/aaa/bbb3
http://domain2.com/
http://domain2.com/aaa
http://domain2.com/aaa/bbb
http://domain2.com/aaa/bbb2
http://domain2.com/aaa/bbb3
http://domain3.com/
http://domain3.com/aaa
http://domain3.com/aaa/bbb
http://domain3.com/aaa/bbb2
http://domain3.com/aaa/bbb3

问题是当我搜索时,我从一个域中得到许多相似的结果,而从下一个域中得到的结果从 30-100 doc 开始。如何从顶部的不同域获取结果。

您必须将 URL 的域名分隔到它自己的字段中。您不能使用 url 字段,因为它已经只包含唯一值,并且您用于分组的字段也应该是 string 字段(即它不会被拆分成多个标记)。

然后您可以使用 Collapse & Expand support 折叠基于域的结果集:

q=...&fq={!collapse field=domain}&expand=true