-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 posts ] 
Author Message
 Post subject: @NumericField and NumericRangeQuery
PostPosted: Wed Jun 27, 2012 1:30 pm 
Newbie

Joined: Wed Jun 27, 2012 1:21 pm
Posts: 2
Hello.
I repost here this question I posted at http://stackoverflow.com/questions/1122 ... defined-wi

I use hibernate search 4.1.0 with good results except for this problem. I´m trying to perform a range search in a column defined:

Code:
@Field(name = "startTime", store = Store.YES)
@NumericField
public Float startTime;


I have stored an item with startTime = 0.0f;

then I try to perform a range query:

Code:
NumericRangeQuery<Float> rangeQuery = NumericRangeQuery.newFloatRange(
                "startDate", -100000.0f, +100000.0f, true, true);
FullTextQuery fullTextQuery = fullTextEntityManager
                .createFullTextQuery(rangeQuery, Item.class);
results = fullTextQuery.getResultList();


First: I have no results.

Second: Inspecting the index with lukeall, I see simply stored what seems to be the toString() [judging by other experiments too], which looks not normal...

I feel like I´m missing something, any help would be appreciated. Thanks


Top
 Profile  
 
 Post subject: Re: @NumericField and NumericRangeQuery
PostPosted: Wed Jun 27, 2012 4:14 pm 
Hibernate Team
Hibernate Team

Joined: Fri Oct 05, 2007 4:47 pm
Posts: 2536
Location: Third rock from the Sun
Hi Pitagoras,
on the first issue, I think you're targeting the wrong field name; the field is "startTime", not "startDate". Unfortunately Lucene has no schema so it's hard to detect such an error over an intentional exotic mapping.

on second: what you see in Luke is the result of Store.YES

_________________
Sanne
http://in.relation.to/


Top
 Profile  
 
 Post subject: Re: @NumericField and NumericRangeQuery
PostPosted: Wed Jun 27, 2012 4:24 pm 
Newbie

Joined: Wed Jun 27, 2012 1:21 pm
Posts: 2
sanne.grinovero wrote:
I think you're targeting the wrong field name; the field is "startTime", not "startDate".


Wow! this is so embarrassing! Thanks for pointing it out!
Now it´s working fine!
Thank you.


Top
 Profile  
 
 Post subject: Re: @NumericField and NumericRangeQuery
PostPosted: Wed Jun 27, 2012 4:56 pm 
Hibernate Team
Hibernate Team

Joined: Fri Oct 05, 2007 4:47 pm
Posts: 2536
Location: Third rock from the Sun
n.p. you're welcome! It's hard to spot such problems ;-)

You actually got me thinking if & how we could detect such an issue, but I'm afraid that's not possible when wrapping a Lucene Query directly. If you where using the DSL (The QueryBuilder) it should throw a runtime exception about the field not being known.

_________________
Sanne
http://in.relation.to/


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.