Solr - 阻塞连接具有许多Children约束的父查询 [英] Solr - Block join Parent query with many Children constraints

查看:342
本文介绍了Solr - 阻塞连接具有许多Children约束的父查询的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

此问题适用于以下嵌套文档:

The question is applied for the following nested documents:

<doc>
  <field name="id">1</field>
  <field name="title">Solr has block join support</field>
  <field name="content_type">parentDocument</field>
  <doc>
    <field name="id">11</field>  
    <field name="type">comment</field>  
    <field name="comments">SolrCloud supports it too!</field>
  </doc>
  <doc>
    <field name="id">12</field>  
    <field name="type">publisher</field>  
    <field name="address">England</field>
    ....
  </doc>
</doc>
....

我的问题是,如何编写块加入父查询允许有多个嵌套的孩子文档的约束?我没有尝试以下,但它不工作:

My question is, how to write the Block Join Parent Query which allows to have constraints on multiple nested children documents? I did try the following, but it did not work:

{!parent which="content_type:accommodation"}
(
  (+type:comment +comments:SolrCloud) AND
  (+type:publisher +address:England)
) 

0作为结果返回!

推荐答案

您可以只有多个块连接过滤器:

For your use case you can just multiple block join filters:

q=*:*&
fq={!parent which="content_type:accommodation"}(+type:comment +comments:SolrCloud)&
fq={!parent which="content_type:accommodation"}(+type:publisher +address:England)


b $ b

第一个过滤器将找到哪些父文档具有满足条件(+ type:comment + comments:SolrCloud)的子元素。

第二个过滤器将在满足第一个过滤器的父文档子集上操作。并且在这个子集中将找到满足条件(+ type:publisher + address:England)的父文档。

The second filter clouse will operate over subset of parent documents that satisfy the first filter. And it will find in this subset the parent documents that satisfy condition (+type:publisher +address:England).

这篇关于Solr - 阻塞连接具有许多Children约束的父查询的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆