首页 > 解决方案 > 具有多选分面和搜索的嵌套文档

问题描述

我有一个 Solr (v8.8) 设置:

我正在关注本教程,它提供了这个示例:

curl http://localhost:8983/solr/collection1/query -d
'q={!parent tag=top filters=$child.fq which=scope:product v=$childquery}&
childquery=scope:sku&
child.fq={!tag=color}color:black&
child.fq={!tag=size}size:L&
fq={!tag=top}category:clothes&
json.facet=
{
   colors:{  
    domain: {
        excludeTags:top,
        filter:["{!filters param=$child.fq  excludeTags=color
            v=$childquery}",
            "{!child of=scope:product filters=$fq}scope:product"]
    },       
    type:terms,
    field:color,
    limit:-1,
    facet:{                              
            productsCount:"uniqueBlock(_root_)"
    }
   },    
   sizes:{       
    domain: {
        excludeTags:top,
        filter:["{!filters param=$child.fq excludeTags=size
            v=$childquery}",
            "{!child of=scope:product filters=$fq}scope:product"]
    },
    type:terms,
    field:size,
    limit:-1,
    facet:{                              
            productsCount:"uniqueBlock(_root_)"
    }
   }
}'

在我的例子中,我添加fl=*,[child]了文档以嵌套结构返回。

这很好用,直到我为父文档添加了纯文本搜索,如官方文档(来自 v8.0)中所述:

q=+description:digital +{!parent tag=top filters=$child.fq which=scope:product v=$childquery}

返回的文档是正确的(相关结果等),但方面完全缺失。

更新

我目前的解决方法是通过添加参数来仅搜索子文档childquery

标签: solre-commerce

解决方案


推荐阅读