hm. try to convert it to query q=-color:({* TO red} {red TO *}) and check
the explanation from debugQuery=true
I tried to play with my index
"q": "*:*",
"facet.field": "swatchColors_string_mv",
"fq": "-swatchColors_string_mv:({* TO RED} {RED TO *})",
I got the following facets:
"facet_fields": {
"swatchColors_string_mv": [
"RED",
122,
"BLACK",
0,
"BLUE",
0,
"BROWN",
0,
"GREEN",
0,
so, it works for me at least...
On Sun, Sep 28, 2014 at 12:54 AM, White, Bill <[email protected]> wrote:
> Hmm. If I understand correctly this builds a set out of open intervals
> (exclusive ranges), that's a great idea!
>
> It doesn't seem to work for me, though; fq=-color:({* TO red} {red TO *})
> is giving me results with color="burnt sienna"
>
> The field is defined as <field name="color" type="string" indexed="true"
> stored="true" multiValued="true" />
>
> On Sat, Sep 27, 2014 at 4:43 PM, Mikhail Khludnev <
> [email protected]> wrote:
>
> > indeed!
> > the exclusive range {green TO red} matches to the "lemon yellow"
> > hence, the negation suppresses it from appearing
> > fq=-color:{green TO red}
> > then you need to suppress eg black and white also
> > fq=-color:({* TO green} {green TO red} {red TO *})
> >
> > I have no control over the
> > > possible values of 'color',
> >
> > You don't need to control possible values, you just suppressing any
> values
> > beside of the given green and red.
> > Mind that either green or red passes that negation of exclusive ranges
> > disjunction.
> >
> >
> > On Sun, Sep 28, 2014 at 12:15 AM, White, Bill <[email protected]> wrote:
> >
> > > 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 <
> > > [email protected]> wrote:
> > >
> > > > On Sat, Sep 27, 2014 at 11:36 PM, White, Bill <[email protected]>
> 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>
> > > > <[email protected]>
> > > >
> > >
> >
> >
> >
> > --
> > Sincerely yours
> > Mikhail Khludnev
> > Principal Engineer,
> > Grid Dynamics
> >
> > <http://www.griddynamics.com>
> > <[email protected]>
> >
>
--
Sincerely yours
Mikhail Khludnev
Principal Engineer,
Grid Dynamics
<http://www.griddynamics.com>
<[email protected]>