lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Yonik Seeley <yo...@heliosearch.com>
Subject Re: fq syntax for requiring all multiValued field values to be within a list?
Date Sat, 27 Sep 2014 19:41:42 GMT
On Sat, Sep 27, 2014 at 3:36 PM, White, Bill <bwhite@ptfs.com> wrote:
> Sorry, color is multivalued, so a given record might be both blue and red.
> I don't want those to show up in the results.

I think the only way currently (out of the box) is to enumerate the
other possible colors to exclude them.

color:(red yellow green)  -color:(blue cyan xxx)

-Yonik
http://heliosearch.org - native code faceting, facet functions,
sub-facets, off-heap data



> On Sat, Sep 27, 2014 at 3:36 PM, White, Bill <bwhite@ptfs.com> wrote:
>
>> Not just that.  I'm looking for things which match either red or yellow or
>> green, but do NOT match ANY other color.  I can probably drop the
>> requirement related to having no color.
>>
>> On Sat, Sep 27, 2014 at 3:28 PM, Yonik Seeley <yonik@heliosearch.com>
>> wrote:
>>
>>> On Sat, Sep 27, 2014 at 2:52 PM, White, Bill <bwhite@ptfs.com> wrote:
>>> > Hello,
>>> >
>>> > I've attempted to figure this out from reading the documentation but
>>> > without much luck.  I looked for a comprehensive query syntax
>>> specification
>>> > (e.g., with BNF and a list of operator semantics) but I'm unable to find
>>> > such a document (does such a thing exist? or is the syntax too much of a
>>> > moving target?)
>>> >
>>> > I'm using 4.6.1, if that makes a difference, though upgrading is an
>>> option
>>> > if it necessary to make this work.
>>> >
>>> > I've got a multiValued field "color", which describes the colors of
>>> item in
>>> > the database.  Items can have zero or more colors.  What I want is to be
>>> > able to filter out all hits that contain colors not within a
>>> constraining
>>> > list, i.e., something like
>>> >
>>> > NOT (color NOT IN ("red","yellow","green")).
>>> >
>>> > So the following would be passed by the filter:
>>> > (no value for 'color')
>>> > color: red
>>> > color: red, color: green
>>> >
>>> > whereas these would be excluded:
>>> > color: red, color: blue
>>> > color: magenta
>>>
>>> You're looking for things that either match red, yellow, or green, or
>>> have no color:
>>>
>>> color:(red yellow green) OR (*:* -color:*)
>>>
>>> -Yonik
>>> http://heliosearch.org - native code faceting, facet functions,
>>> sub-facets, off-heap data
>>>
>>
>>

Mime
View raw message