使用 Solr 进行分面搜索
我是一名新手,正在学习 Solr 库的分面搜索。我想使用上述内容为我的项目生成标签云。谁能举例说明如何完成它及其基本设置?
I am a newbie and learning facet search with the Solr library. I want to generate a tag cloud using the above for my project. Can anyone please give an example as to how it can be done along with its basic setup?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
假设您要为其生成云的字段名为
myField
并且您想要一个最多包含 50 个标签的云,这可能是您的搜索:这将为您提供不带行的查询响应但有一个“方面计数”部分。然后,您可以使用这些术语计数来确定每个标签的字体大小(可能以对数方式)。
请记住,您的字段应包含 空白标记生成器 并且不应进行过多的“处理” " 在索引时使用分析器(例如词干提取),否则您的方面术语可能与您预期的不一样。如果是这种情况,请使用 copyField 将您的内容在处理较少的字段中编入索引。
您还有一大堆其他分面选项可用于调整标签云:SimpleFacetParameters。
Assuming that the field you want to generate a cloud for is named
myField
and that you want a cloud with a maximum of 50 tags, this could be your search:This will give you a query response with no rows but with a "facet counts" section. Then you can use those term counts to determine the font size of every tag (probably in a logarithmic fashion).
Keep in mind that your field should include a whitespace tokenizer and should not be too heavily "processed" with analyzers (e.g. stemming) at index time, or your facet terms might not be as you expect. If that is the case, use copyField to get your content indexed in a less processed field.
You've got a whole bunch of other faceting options available to tune your tag cloud: SimpleFacetParameters.