Greater than / lower than range requests #167

Open
matcho opened this Issue Oct 29, 2012 · 6 comments

Comments

Projects
None yet
3 participants

matcho commented Oct 29, 2012

In Lucene documentation, it's specified that a NumericRangeQuery can accept 'null' as a bound:
setting lower bound to 'null' produces a "lower than" query; setting upper bound to 'null' produces a "greater than" query.
It doesn't seem to be possible to pass 'null' with c-l ... tried "", "null", null with no success.

Thanks,
Mat

Tom9729 commented Feb 14, 2014

I would also like a fix for this. I saw suggested somewhere that setting the lower/upper bound to * would work, but this does not seem to work for number/date at least. I suspect that this would work for strings but have not had a chance to try it. My current workaround is to look at the type of field and guess an appropriate upper/lower bound (eg. for number use 99999999999999999 or something along those lines).

Owner

rnewson commented Feb 14, 2014

You should be able to specify -Infinity and Infinity for lower and upper respectively. Ping me here if that doesn't work and I'll pull up the code.

Tom9729 commented Feb 14, 2014

Doesn't work with Long because there is no concept of infinity. Also I don't think this would work with dates.

Owner

rnewson commented Feb 14, 2014

Good point. It should be a simple enough tweak to the query parser subclass. I don't have a lot of spare time so this might be a while, unless you're happy to dig in and get a patch going?

Tom9729 commented Feb 14, 2014

I will continue with my workaround for now, just wanted to get this logged. When I find some time I may be able to contribute a patch.

Owner

rnewson commented Feb 14, 2014

righto, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment