Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/apache/9.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
Apache “字段列表”;exists();不正确的_Apache_Solr - Fatal编程技术网

Apache “字段列表”;exists();不正确的

Apache “字段列表”;exists();不正确的,apache,solr,Apache,Solr,Solr 4.2.1 似乎无论我尝试什么,都无法从exists()函数中获得正确的结果。我使用它来检查模式中是否存在“text\u general”类型的字段。它在某种程度上起作用,但有10%的情况下是错误的 下面是我在查询的FL部分使用的简化代码,用于测试它 fl=list:if(exists(title),1,0),title 这是我得到的一个不正确的样本记录 <str name="title">Tonight Tonight</str> #Obviously ex

Solr 4.2.1

似乎无论我尝试什么,都无法从exists()函数中获得正确的结果。我使用它来检查模式中是否存在“text\u general”类型的字段。它在某种程度上起作用,但有10%的情况下是错误的

下面是我在查询的FL部分使用的简化代码,用于测试它

fl=list:if(exists(title),1,0),title
这是我得到的一个不正确的样本记录

<str name="title">Tonight Tonight</str> #Obviously exists
<long name="list">0</long></doc> #Still returns 0
今晚显然存在 0#仍然返回0 这是我的模式定义,也许text_general对此有问题?我在文件里找不到关于它的任何东西

<field name="title" type="text_general" indexed="true" stored="true" required="false" multiValued="false" />


如果要检查该字段是否存在,请感谢


您也可以尝试
-field:[“”TO*]

此解决方案的问题是它在布尔函数查询中不起作用。这意味着我不能在if语句中使用它作为检查。是否要返回该值?是的,我只是使用1和0来指出它的中断。完整的查询看起来更像
fl=list:if(exists(title),title,somethingElse),title
Edit:我实际上已经解决了这个问题,让我的MySQL导入查询为我进行检查并分配了适当的值。我仍然很好奇为什么这不起作用。这可能是一个bug,行为看起来很不一致。
-field:[* TO *] finds all documents without a value for field