我有一个索引的存储 bool 字段,我试图将其用作过滤器:
<field name="is_instrumental" type="boolean" indexed="true" stored="true" />
但是,当我尝试将其用作 fq 参数时,查询返回零结果:
select?q=*:*&fq=is_instrumental:true&wt=xml&indent=true
<response>
<lst name="responseHeader">
<int name="status">0</int>
<int name="QTime">0</int>
<lst name="params">
<str name="indent">true</str>
<str name="q">*:*</str>
<str name="wt">xml</str>
<str name="fq">is_instrumental:true</str>
</lst>
</lst>
<result name="response" numFound="0" start="0"></result>
</response>
我已经尝试了我能想到的所有组合(真、假、1、0、真、假,也在引号中),无论我尝试什么,它都不会返回任何内容。其他字段(整数或字符串)的过滤器工作得很好。使用 Solr 4.1。
我错过了什么?
编辑:
solrconfig.xml: http://pastebin.com/kGWhQBma
架构.xml:http://pastebin.com/uqnYuuHR
最佳答案
您的查询语法没有问题 &fq=is_instrumental:true
应该管用。
我的猜测是,您正在使用/select 请求处理程序的自定义版本,它正在实现一个自定义查询解析器,例如 eDisMax (Extended Dismax)解析器。也许&uf
参数已设置为防止现场搜索。你能检查一下你的 solrconfig.xml,看看 <requestHandler name="/select" class="solr.SearchHandler">
的默认值如何?配置定义?
关于Solr:在 bool 字段上使用过滤器查询?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15747590/