Solr: Using the Block Join Children Query Parser

夙愿已清 提交于 2019-12-06 13:46:30

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

The syntax for this parser is: q={!child of=<allParents>}<someParents>. The parameter allParents is a filter that matches only parent documents

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.

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

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.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!