2015-08-27 11:27 GMT+02:00 Hardy Ferentschik <hardy(a)hibernate.org>:
On Wed, Aug 26, 2015 at 09:58:39PM +0100, Sanne Grinovero wrote:
> Assuming you build a Lucene Query the following way:
>
> queryBuilder.keyword().onField( "age" ).matching( 5 ).createQuery();
>
> What is your expectation, if the "age" field is being indexed as a
NumericField?
I would say that this throws an exception. At least atm. Numeric encoded
fields needs to be targeted by a range query. One could imagine to transparently
create a range query in this case. I guess by the metadata we could tell that we have
a numeric field. However, that's a a lot of magic then, in particular since we
always that that a keyword query maps to a TermQuery.
Hum, but that's already happening, no?
See DSLTest.testUseOfFieldBridge() where we do exactly that:
monthQb.keyword().onField( "monthValue" ).matching( 2 ).createQuery();
Internally it's creating a NumericRangeQuery with start/end set to the
same value.
If the field uses a null encoding bridge, it'd be a String field,
though, if I am not mistaken (unless we use some numeric null encoding
as discussed recently), so a simple TermQuery query would be the right
thing.
--Hardy
_______________________________________________
hibernate-dev mailing list
hibernate-dev(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/hibernate-dev