how to make RangeQuery action as > < != operators?

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

how to make RangeQuery action as > < != operators?

David-317
Hi all:
    I need to make range query actions as > < and != operators, The
RangeQuery class just support RangeQuery(begin, end, inclusive), but How to
support > < and != ?

Appreciate your help!

--
David
Reply | Threaded
Open this post in threaded view
|

Re: how to make RangeQuery action as > < != operators?

kapilChhabra
In my case, I know the upper and lower limits of my field.
So it becomes easy for me to run such queries.

eg.

*>  *
RangeQuery(value, upperLimit, inc)

*<*
RangeQuery(lowerLimit, value, inc)

*!=*
Use the in this case.
eg:
-field:value

Regards,
kapilChhabra

David wrote:
> Hi all:
>    I need to make range query actions as > < and != operators, The
> RangeQuery class just support RangeQuery(begin, end, inclusive), but
> How to
> support > < and != ?
>
> Appreciate your help!
>

Reply | Threaded
Open this post in threaded view
|

Re: how to make RangeQuery action as > < != operators?

Chris Hostetter-3
In reply to this post by David-317

1) "!=" is really not a range operation at all.
2) if you look at the javadocs for RangeQuery you will see...

  Constructs a query selecting all terms greater than lowerTerm but less
  than upperTerm. There must be at least one term and either term may be
  null, in which case there is no bound on that side, but if there are two
  terms, both terms must be for the same field.

...which explains how you can get a <, <=, >, and >= queries.

3) don't use RangeQuery ... use ConstantScoreRange ... the mailing list
archives have lots of discussion on why it's better and what the limited
use cases are where using a RangeQuery may make sense.



: Date: Thu, 18 Jan 2007 18:13:41 +0800
: From: David <[hidden email]>
: Reply-To: [hidden email]
: To: [hidden email]
: Subject: how to make RangeQuery action as > < != operators?
:
: Hi all:
:     I need to make range query actions as > < and != operators, The
: RangeQuery class just support RangeQuery(begin, end, inclusive), but How to
: support > < and != ?
:
: Appreciate your help!
:
: --
: David
:



-Hoss


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]