SOLR 中的嵌套字段
我有一个关于在 solr 中创建嵌套字段的可能性的问题。 谷歌搜索告诉我一些关于团体的信息,但我认为这只是为了结果?
我想要的是这样的结构:
- Category1
- 第 1 项 (9)
- 第 2 项 (8)
- 类别 2
- 第 3 项 (6)
- 类别 3
- 第 4 项 (23)
我尝试了这样的操作:
<field name="Category" type="string" indexed="true" stored="true" multiValued="true" required="false">
<field name="MiscellaneousName" type="string" indexed="true" stored="true" multiValued="true" required="false"/>
但它不起作用。
更新: 类别和项目应该是多面的。每个项目(=facet)都是类别的一部分。一个类别可以有多个字段或空字段。类别和项目存储在数据库中,我想动态索引它们。我只想搜索项目,类别只是文本。我正在使用 solr 3.3 和 Tomcat 7。
I've got a question about the possibility to create nested fields in solr.
Google searches told me something about group but I think its just for the result?
what I want to have is a structure like that:
- Category1
- item 1 (9)
- item 2 (8)
- Category2
- item 3 (6)
- Category3
- item 4 (23)
I tried something like this:
<field name="Category" type="string" indexed="true" stored="true" multiValued="true" required="false">
<field name="MiscellaneousName" type="string" indexed="true" stored="true" multiValued="true" required="false"/>
But it does not work.
Update:
The categories and items should be faceted. Everey item(=facet) is part of a category. One Category could have multiple or null fields. The Categories and items are stored in a database an I want to index them dynamically. I only want to search for the items, the categories are just text. I'm using solr 3.3 with Tomcat 7.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
感谢您的更新。 枢轴面允许您执行以下操作:
.. 但它们仅在 Solr 4.0(主干)中可用。不过,您可以在较低版本的 Solr(低至 1.4)中模拟这些结果,尽管它有点复杂并且需要两个 Solr 查询而不是一个。我就此写了一篇博客文章 - Pivot Faceting(决策树)在 Solr 1.4 中。
您可以保留原始问题中的架构 - 枢轴分面(真实或模拟)适用于任何任意、不同(或相同)的字段。
Thanks for the update. Pivot facets allow you to do something like:
.. but they are only available in Solr 4.0 (trunk). You can, however, simulate these results in lower Solr's (down to 1.4), although it is a bit complicated and requires two Solr queries instead of one. I wrote a blog post on this -- Pivot Faceting (Decision Trees) in Solr 1.4.
You can keep the schema you have in your original question -- pivot faceting (real or simulated) works on any arbitrary, different (or same) fields.
枢轴面是定义层次结构面所需的。
但是,您需要使用主干构建才能使其正常工作。
如果您在升级时遇到问题,可以检查选项 @ http:// /www.lucidimagination.com/why-lucid/webinars/mastering-power-faceted-search
这是一种解决方法,需要您操纵您提供的数据。
它与 -
的组合一起使用
使用 fq=category:"0//Category1" 过滤结果
如果您需要限制结果,facet.prefix 将帮助您根据级别限制构面
另外 http: //wiki.apache.org/solr/HierarchicalFaceting,可能有用。
Pivot facets is what you need to define hierarchy faceting.
However, you would need to use the trunk build to have it working.
If you have issues upgrading, you can check the option @ http://www.lucidimagination.com/why-lucid/webinars/mastering-power-faceted-search
This is a workaround, and needs you to manipulate the data you feed.
It works with a combination of -
filter results using fq=category:"0//Cattegory1"
facet.prefix which will help you to limit the facets depending on the level, if you need to limit results
Also http://wiki.apache.org/solr/HierarchicalFaceting, might be useful.
您能否将类别设置为项目的一个字段,以便例如当您搜索类别 1 时,项目 1 和 2 会返回到结果中?
如果您有两个字段绝对必须是实体的一部分并且必须彼此关联,则聚合字段可能会有所帮助。它们是为诸如具有 x 和 y 值的点之类的东西而设计的。
我认为我们需要更多地了解您到底想做什么,以提出在 Solr 中处理它的好方法。
Could you make the category just a field of the item, so that e.g. when you search category 1 item 1 and 2 come back in the results?
If you have two fields that absolutely have to be part of an entity and have to be associated with each other, poly fields might help. They were designed for things like a point that has an x and y value.
I think we need to know more about what exactly you are trying to do to suggest good ways to handle it in Solr.