Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/templates/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
有没有办法过滤solr中没有模式属性的文档?_Solr - Fatal编程技术网

有没有办法过滤solr中没有模式属性的文档?

有没有办法过滤solr中没有模式属性的文档?,solr,Solr,假设我们有以下solr产品文档 { name: 'jeans', .... category_51_sub_98: [678,89] }, { name: 'leggings', .... category_51_sub_97: [75] }, { name: 'shirts', .... category_52_sub_23: [75] }, { name: 'tees', .... category_53_sub_14: [89] } 现在我想应用一个过滤器来获取一个文档,该文档没有带有r

假设我们有以下solr产品文档

{
name: 'jeans',
....
category_51_sub_98: [678,89]
},
{
name: 'leggings',
....
category_51_sub_97: [75]
},
{
name: 'shirts',
....
category_52_sub_23: [75]
},
{
name: 'tees',
....
category_53_sub_14: [89]
}
现在我想应用一个过滤器来获取一个文档,该文档没有带有regex模式
category\u 51\u sub\d+
的属性,这意味着只获取衬衫和t恤的结果集。在solr中可以这样做吗?
我尝试了
fq=(*:*-类别\u 51\u子类\ud+:[*到*])
,但没有成功。非常感谢任何解决方案。

据我所知,您无法对字段名进行正则表达式或通配符匹配。您可能会为它编写一个自定义过滤器。但是,将字段名作为一个附加字段进行索引也会更加有效,这样您就有了
category\u字段:['category\u 53\u sub\u 14']
,然后对其进行匹配(因为您可以使用
字段:/regex/
对令牌进行正则表达式匹配-但在这种情况下,使用
类别\u 53\u sub.*
的常规前缀匹配将起作用)