alex_c
alex_c

Reputation: 2046

Solr: Using a Filter Query on a boolean field?

I have an indexed, stored Boolean field that I'm trying to use as a filter:

<field name="is_instrumental" type="boolean" indexed="true" stored="true" />

However, when I try to use it as a fq parameter, the query returns zero results:

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>

I've tried every combination I can think of (true, false, 1, 0, TRUE, FALSE, also in quotes), no matter what I try it doesn't return anything. Filters on other fields (ints or strings) work perfectly fine. Using Solr 4.1.

What am I missing?

Edit:

solrconfig.xml: http://pastebin.com/kGWhQBma

schema.xml: http://pastebin.com/uqnYuuHR

Upvotes: 5

Views: 9655

Answers (1)

Paige Cook
Paige Cook

Reputation: 22555

There is nothing wrong with your query syntax &fq=is_instrumental:true should work.

My guess here is that you are using a customized version of the /select request handler that is implementing a custom query parser like the eDisMax (Extended Dismax) Parser. Perhaps the &uf parameter has been set to prevent fielded searches. Can you check your solrconfig.xml and see how the defaults for the <requestHandler name="/select" class="solr.SearchHandler"> configuration are defined?

Upvotes: 2

Related Questions