Re: syntax for negative query OR something
: How do I search for things that have no value or a specified value? Things with no value... (*:* -fieldName:[* TO *]) Things with a specific value... fieldName:A Things with no value or a specific value... (*:* -fieldName:[* TO *]) fieldName:A ...or if you aren't using OR as your default op (*:* -fieldName:[* TO *]) OR fieldName:A : I have a few variations of: : -fname:[* TO *] OR fname:(A B C) that is just syntacitic sugar for... -fname:[* TO *] fname:(A B C) which is an empty set. you need to be explicit that the exclude docs with a value in this field clause should applied to the set of all documents -Hoss
Re: syntax for negative query OR something
Sounds good. OR in the negation of any query that matches any possible value in a field. The Solr query parser doc lists the open range as you used: -field:[* TO *] finds all documents without a value for field See: http://wiki.apache.org/solr/SolrQuerySyntax This also include pure wildcard that can generate a PrefixQuery: -fname:* OR fname:(A B C) -- Jack Krupansky -Original Message- From: Ryan McKinley Sent: Wednesday, May 02, 2012 7:18 PM To: solr-user@lucene.apache.org Subject: syntax for negative query OR something How do I search for things that have no value or a specified value? Essentially I have a field that *may* exist and what the absense of a field to also match. I have a few variations of: -fname:[* TO *] OR fname:(A B C) Thanks for any pointers ryan
Re: syntax for negative query OR something
Oops... that is: (-fname:*) OR fname:(A B C) or (-fname:[* TO *]) OR fname:(A B C) -- Jack Krupansky -Original Message- From: Jack Krupansky Sent: Wednesday, May 02, 2012 7:48 PM To: solr-user@lucene.apache.org Subject: Re: syntax for negative query OR something Sounds good. OR in the negation of any query that matches any possible value in a field. The Solr query parser doc lists the open range as you used: -field:[* TO *] finds all documents without a value for field See: http://wiki.apache.org/solr/SolrQuerySyntax This also include pure wildcard that can generate a PrefixQuery: -fname:* OR fname:(A B C) -- Jack Krupansky -Original Message- From: Ryan McKinley Sent: Wednesday, May 02, 2012 7:18 PM To: solr-user@lucene.apache.org Subject: syntax for negative query OR something How do I search for things that have no value or a specified value? Essentially I have a field that *may* exist and what the absense of a field to also match. I have a few variations of: -fname:[* TO *] OR fname:(A B C) Thanks for any pointers ryan
Re: syntax for negative query OR something
Hmmm... I thought that worked in edismax. And I thought that pure negative queries were allowed in SolrQueryParser. Oh well. In any case, in the Lucene or Solr query parser, add *:* to select all docs before negating the docs that have any value in the field: (*:* -fname:*) OR fname:(A B C) or (*:* -fname:[* TO *]) OR fname:(A B C) -- Jack Krupansky -Original Message- From: Jack Krupansky Sent: Wednesday, May 02, 2012 7:52 PM To: solr-user@lucene.apache.org Subject: Re: syntax for negative query OR something Oops... that is: (-fname:*) OR fname:(A B C) or (-fname:[* TO *]) OR fname:(A B C) -- Jack Krupansky -Original Message- From: Jack Krupansky Sent: Wednesday, May 02, 2012 7:48 PM To: solr-user@lucene.apache.org Subject: Re: syntax for negative query OR something Sounds good. OR in the negation of any query that matches any possible value in a field. The Solr query parser doc lists the open range as you used: -field:[* TO *] finds all documents without a value for field See: http://wiki.apache.org/solr/SolrQuerySyntax This also include pure wildcard that can generate a PrefixQuery: -fname:* OR fname:(A B C) -- Jack Krupansky -Original Message- From: Ryan McKinley Sent: Wednesday, May 02, 2012 7:18 PM To: solr-user@lucene.apache.org Subject: syntax for negative query OR something How do I search for things that have no value or a specified value? Essentially I have a field that *may* exist and what the absense of a field to also match. I have a few variations of: -fname:[* TO *] OR fname:(A B C) Thanks for any pointers ryan
Re: syntax for negative query OR something
thanks! On Wed, May 2, 2012 at 4:43 PM, Chris Hostetter hossman_luc...@fucit.org wrote: : How do I search for things that have no value or a specified value? Things with no value... (*:* -fieldName:[* TO *]) Things with a specific value... fieldName:A Things with no value or a specific value... (*:* -fieldName:[* TO *]) fieldName:A ...or if you aren't using OR as your default op (*:* -fieldName:[* TO *]) OR fieldName:A : I have a few variations of: : -fname:[* TO *] OR fname:(A B C) that is just syntacitic sugar for... -fname:[* TO *] fname:(A B C) which is an empty set. you need to be explicit that the exclude docs with a value in this field clause should applied to the set of all documents -Hoss