You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by Kyle Miller <ky...@gmail.com> on 2008/06/25 00:31:52 UTC
How to do a query using less than or greater than
Hi all,
I've been looking at the lucene documentation and the source code
and I can't seem to find a greater than or less than operator in the
default query syntax for lucene. Does anyone one know if they exists
and how to use them? For a concrete example I'm looking to do a query
on a date field to find documents earlier than a specified date or
later than a specified date. Ex: date:( >20070101) or date:
(<20070101). I looked at the range query feature but it didn't appear
to cover this case. Anyone have any suggestions?
Thanks,
Kyle
Re: How to do a query using less than or greater than
Posted by "J. Delgado" <jo...@gmail.com>.
I do not believe that the operators "<" and ">" are supported by
Lucene, but you can use RANGE SEARCH to do achieve what you want. Just
put an unreachable upper boundary for "greater than" or lower boundary
for "less than".
J.D.
On Tue, Jun 24, 2008 at 3:31 PM, Kyle Miller <ky...@gmail.com> wrote:
> Hi all,
> I've been looking at the lucene documentation and the source code
> and I can't seem to find a greater than or less than operator in the
> default query syntax for lucene. Does anyone one know if they exists
> and how to use them? For a concrete example I'm looking to do a query
> on a date field to find documents earlier than a specified date or
> later than a specified date. Ex: date:( >20070101) or date:
> (<20070101). I looked at the range query feature but it didn't appear
> to cover this case. Anyone have any suggestions?
> Thanks,
> Kyle
---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-dev-help@lucene.apache.org
Re: How to do a query using less than or greater than
Posted by Kyle Miller <ky...@gmail.com>.
Chris,
That's exactly what I was looking for. Thanks for the info and the
clarification on where to post my questions.
Regards,
Kyle
On Wed, Jun 25, 2008 at 5:12 PM, Chris Hostetter <ho...@fucit.org>
wrote:
>
> : and how to use them? For a concrete example I'm looking to do a query
> : on a date field to find documents earlier than a specified date or
> : later than a specified date. Ex: date:( >20070101) or date:
> : (<20070101). I looked at the range query feature but it didn't appear
> : to cover this case. Anyone have any suggestions?
>
> RangeQuery (and ConstantScoreRangeQuery) can both cover this case by
> setting either the upper or lowe term to null.
>
>
> Incidently...
> http://people.apache.org/~hossman/#java-dev<http://people.apache.org/%7Ehossman/#java-dev>
> Please Use "java-user@lucene" Not "java-dev@lucene"
>
> Your question is better suited for the java-user@lucene mailing list ...
> not the java-dev@lucene list. java-dev is for discussing development of
> the internals of the Lucene Java library ... it is *not* the appropriate
> place to ask questions about how to use the Lucene Java library when
> developing your own applications. Please resend your message to
> the java-user mailing list, where you are likely to get more/better
> responses since that list also has a larger number of subscribers.
>
>
>
>
>
> -Hoss
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-dev-help@lucene.apache.org
>
>
Re: How to do a query using less than or greater than
Posted by Chris Hostetter <ho...@fucit.org>.
: and how to use them? For a concrete example I'm looking to do a query
: on a date field to find documents earlier than a specified date or
: later than a specified date. Ex: date:( >20070101) or date:
: (<20070101). I looked at the range query feature but it didn't appear
: to cover this case. Anyone have any suggestions?
RangeQuery (and ConstantScoreRangeQuery) can both cover this case by
setting either the upper or lowe term to null.
Incidently...
http://people.apache.org/~hossman/#java-dev
Please Use "java-user@lucene" Not "java-dev@lucene"
Your question is better suited for the java-user@lucene mailing list ...
not the java-dev@lucene list. java-dev is for discussing development of
the internals of the Lucene Java library ... it is *not* the appropriate
place to ask questions about how to use the Lucene Java library when
developing your own applications. Please resend your message to
the java-user mailing list, where you are likely to get more/better
responses since that list also has a larger number of subscribers.
-Hoss
---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-dev-help@lucene.apache.org