如何在 Solr 中实现具有多个相关项的分面搜索建议?

发布于 2024-10-16 05:41:53 字数 326 浏览 13 评论 0原文

你好 我的公司对系统的搜索引擎有非常具体的需求,但我似乎找不到解决方案。

我们有一个项目的 SOLR 索引,所有项目都具有相同的字段,其中一个字段是“类型”(当然还有“标题”、“文本”等)。

我需要的是:我得到一个项目类型和一个查询字符串,并且我需要返回一个搜索建议列表,每个搜索建议还说明建议的字符串将返回多少个正确类型的项目。

比如,如果原始字符串是“goo”,我会得到

Goo 10 谷歌 52 古拉格2

等。

现在,我该怎么做? 我不想为每个不同的建议重新查询 SOLR,但如果没有其他方法,我可能会这样做。

提前致谢

Hi
I have a very specific need in my company for the system's search engine, and I can't seem to find a solution.

We have a SOLR index of items, all of them have the same fields, with one of the fields being "Type", (And ofcourse, "Title", "Text", and so on).

What I need is: I get an Item Type and a Query String, and I need to return a list of search suggestion with each also saying how meny items of the correct type will that suggested string return.

Something like, if the original string is "goo" I'll get

Goo 10
Google 52
Goolag 2

and so on.

now, How do I do it?
I don't want to re-query SOLR for each different suggestion, but if there is no other way, I just might.

Thanks in advance

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

染墨丶若流云 2024-10-23 05:41:53

你可以尝试一下分面。看看我的更多详细说明(“自动完成”)。

这是在 http://jetwick.com 上使用 Solr 实现的...现在使用 ElasticSearch,但 Solr 源仍然可用,并且这个想法也是相同的 https://github.com/karussell/Jetwick

You can try facets. Take a look at my more detailed description ('Autocompletion').

This was implemented at http://jetwick.com with Solr ... now using ElasticSearch but the Solr sources are still available and the idea is also the identical https://github.com/karussell/Jetwick

雨夜星沙 2024-10-23 05:41:53

Solr 的 SpellCheckComponent(提供建议)具有扩展结果,可以给出索引中每个建议的频率 - http://wiki.apache.org/solr/SpellCheckComponent#Extended_Results

但是,.Net 组件 SolrNet 目前似乎不支持 ExtendedResults 选项:“所有 SpellCheckComponent 参数均受支持,除了 ExtendedResults 选项” - http://code.google.com/p/solrnet/wiki/SpellChecking

The SpellCheckComponent of Solr (that gives the suggestions) have extended results that can give the frequency of every suggestion in the index - http://wiki.apache.org/solr/SpellCheckComponent#Extended_Results.

However, the .Net component SolrNet, does not currently seem to support the extendedResults option: "All of the SpellCheckComponent parameters are supported, except for the extendedResults option" - http://code.google.com/p/solrnet/wiki/SpellChecking.

随心而道 2024-10-23 05:41:53

这是使用带有前缀集的分面字段查询来实现的。您可以使用 xml 处理程序进行测试,如下所示:

http://localhost:8983/solr/select/?rows=0&facet=true&facet.field=type&f.type.prefix=goo

This is implemented using a facet field query with a Prefix set. You can test this using the xml handler like this:

http://localhost:8983/solr/select/?rows=0&facet=true&facet.field=type&f.type.prefix=goo
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文