lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chris Hostetter <hossman_luc...@fucit.org>
Subject Re: BoolField fieldType
Date Thu, 04 Jun 2015 17:53:02 GMT

: What about at query time?  If I index my Boolean and it has one of the
: variations of "t", "T" or "1", what should my query be to get a hit on
: "true"?  q=MyBoolField:<what> ?  What should the value of <what> be when I
: want to check if the field has a "true" and when I need to check if it has
: a "false"?

the string representations are parsed into the logical concepts -- it 
doesn't matter if one doc was added with a value of "true" and another doc 
was indexed with a value of "T" in the index they both have a true value.

likewise at query time it doesn't matter if you query for "true" or "T" - 
they are both going to find all docs that have a true value, and querying 
for "F" or "false" or "BOGUS" are going to find you all docs with a false 
value.

where things get interesting is is when you deal with documents that do 
not have a value in the field at all -- searching for something like 
this...

	q=-MyBoolField:true

...won't just return all the docs with a false value, it will also return 
all docs w/o any value.

if you want to find all documents that don't have any value, you can 
search for this...

	q=-MyBoolField:*

note that the "*" is a query parser feature, so it causes the query parser 
to do a "docs with value in this field" query w/o ever asking the 
BoolField to "parse" the input string as a true/false value.



-Hoss
http://www.lucidworks.com/

Mime
View raw message