using gt and lt in a query

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

using gt and lt in a query

rhys J
Reply | Threaded
Open this post in threaded view
|

Re: using gt and lt in a query

Shawn Heisey-2
On 11/14/2019 10:49 AM, rhys J wrote:
> I am trying to duplicate this line from a db query:
>
> (debt.orig_princ_amt > 0 AND debt.princ_paid > 0 AND debt.orig_princ_amt >
> debt.princ_paid)
>
> I have the following, but it returns no results:

Range queries are done with brackets and/or braces.  A square bracket
indicates that the range should include the precise value mentioned, and
a curly brace indicates that the range should exclude the precise value
mentioned.

https://lucene.apache.org/solr/guide/8_2/the-standard-query-parser.html#TheStandardQueryParser-RangeSearches

Thanks,
Shawn
Reply | Threaded
Open this post in threaded view
|

Re: using gt and lt in a query

rhys J
> Range queries are done with brackets and/or braces.  A square bracket
> indicates that the range should include the precise value mentioned, and
> a curly brace indicates that the range should exclude the precise value
> mentioned.
>
>
> https://lucene.apache.org/solr/guide/8_2/the-standard-query-parser.html#TheStandardQueryParser-RangeSearches
>
>
But I'm not doing a range, I'm doing a query on whether one field is
greater than another field. Or am I missing something here?

Thanks,

Rhys
Reply | Threaded
Open this post in threaded view
|

Re: using gt and lt in a query

Shawn Heisey-2
On 11/14/2019 11:09 AM, rhys J wrote:
> But I'm not doing a range, I'm doing a query on whether one field is
> greater than another field. Or am I missing something here?

I am unaware of any way to do that with simple query syntax.  Sometimes
there is capability that I do not know about, though.

Solr is not designed for that kind of query.  It's something that
databases do quite well, if the database design is correct.

Thanks,
Shawn
Reply | Threaded
Open this post in threaded view
|

Re: using gt and lt in a query

Erick Erickson
You might be able to make this work with function queries….

Best,
Erick

> On Nov 14, 2019, at 1:26 PM, Shawn Heisey <[hidden email]> wrote:
>
> On 11/14/2019 11:09 AM, rhys J wrote:
>> But I'm not doing a range, I'm doing a query on whether one field is
>> greater than another field. Or am I missing something here?
>
> I am unaware of any way to do that with simple query syntax.  Sometimes there is capability that I do not know about, though.
>
> Solr is not designed for that kind of query.  It's something that databases do quite well, if the database design is correct.
>
> Thanks,
> Shawn

Reply | Threaded
Open this post in threaded view
|

Re: using gt and lt in a query

rhys J