Solr:使用Block Join Children Query Parser

编程入门 行业动态 更新时间:2024-10-14 22:17:38
本文介绍了Solr:使用Block Join Children Query Parser的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

目前,我按照这里所述评估了Block Join Children Query Parser 。

因此我创建了以下集合:

Therefore I have created the following collection:

curl "localhost:8983/solr/admin/collections?action=CREATE&name=nestedPerson&numShards=6"`

然后我插入了这两个文件:

Then I have inserted these two documents:

curl localhost:8983/solr/nestedPerson/update?commitWithin=3000 -d '<add> <doc> <field name="id">p1</field> <field name="deceased">false</field> <doc> <field name="id">c1</field> <field name="firstName">Bob</field> </doc> </doc> <doc> <field name="id">p2</field> <field name="deceased">true</field> <doc> <field name="id">c2</field> <field name="firstName">Max</field> </doc> </doc> </add>'

现在我发出此查询:

{!child of="id:p1"}firstName:Bob

不幸的是,这导致了这个错误:

Unfortunately this results in this error:

"msg": "Parent query yields document which is not matched by parents filter, docID=0",

父查询如何(我想部分 id:p1 意味着产生一个与过滤器不匹配的文件?

How can the parent query (I guess that the part id:p1 is meant) yield a document that is not matched by the filter?

推荐答案

再看一下你再次提到的Solr Wiki 这里。请注意以下内容:

Take a look at the Solr Wiki that you refer to again here. Note the following:

此解析器的语法为:q = {!child of =< allParents>}< someParents>。参数allParents是仅匹配父文档的过滤器

在您的示例中,查询是 {!child of = ID:P1}姓:鲍勃。字段 id 用于< allParents> ,但 id 包含在父文档和子文档中。

In your example, the query is {!child of="id:p1"}firstName:Bob. The field id as used in<allParents>, but id is contained in both parent and child documents.

您需要引入一个只有父文档的字段,例如< field name =content_type> parentDocument< / field>来自wiki的。一旦所有父文档(以及仅父文档)具有此字段,您可以将查询提交为:

You need to introduce a field that only parent documents have, such as <field name="content_type">parentDocument</field> from the wiki. Once all parent documents (and only parent documents) have this field, you could submit the query as:

q = {!parent which = content_type:parentDocument} firstName:Bob

这将匹配 firstName:Bob 并归还他们的父母。以类似的方式,使用 q = {!child of =< allParents>}< someParents> 来匹配父文档并返回他们的孩子。

This would match child documents for firstName:Bob and return their parents. In a similar fashion, use q={!child of=<allParents>}<someParents> to match parent documents and return their children.

更多推荐

Solr:使用Block Join Children Query Parser

本文发布于:2023-11-28 16:10:47,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1643075.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:Join   Block   Solr   Parser   Query

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!