lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "White, Bill" <bwh...@ptfs.com>
Subject Re: fq syntax for requiring all multiValued field values to be within a list?
Date Sat, 27 Sep 2014 20:15:38 GMT
OK, let me try phrasing it better.

How do I exclude from search, any result which contains any value for
multivalued field 'color' which is not within a given "constraint set"
(e.g., "red", "green", "yellow", "burnt sienna"), given that I do not what
any of the other possible values of 'color' are?

In pseudocode:

for all x in result.color
    if x not in ("red","green","yellow", "burnt sienna")
        filter out result

I don't see how range queries would work since I have no control over the
possible values of 'color', e.g., there could be a valid color "lemon
yellow" between "green" and "red", and I don't want a result which has
(color: red, color: "lemon yellow")

On Sat, Sep 27, 2014 at 4:02 PM, Mikhail Khludnev <
mkhludnev@griddynamics.com> wrote:

> On Sat, Sep 27, 2014 at 11:36 PM, White, Bill <bwhite@ptfs.com> wrote:
>
> > but do NOT match ANY other color.
>
>
> Bill, I miss the whole picture, it's worth to rephrase the problem in one
> sentence.
> But regarding the quote above, you can try to use exclusive ranges
>
> https://lucene.apache.org/core/4_6_0/queryparser/org/apache/lucene/queryparser/classic/package-summary.html#Range_Searches
> fq=-color:({* TO green} {green TO red} {red TO *})
> just don't forget to build ranges alphabetically
>
> --
> Sincerely yours
> Mikhail Khludnev
> Principal Engineer,
> Grid Dynamics
>
> <http://www.griddynamics.com>
> <mkhludnev@griddynamics.com>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message