-->
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.  [ 1 post ] 
Author Message
 Post subject: How to build queries with Hibernate Search?
PostPosted: Wed Mar 02, 2011 7:25 am 
Newbie

Joined: Wed Mar 02, 2011 7:02 am
Posts: 1
Hi,

I ve set up my project to use hibernate-search. I have constructed the queries manually. That is, I collect hte user's input and build a String. i.e. "columnA:[A TO B]" and then I give it to lucene's QueryParser.

I have many problems with that because the queries do not all have the expected result. For example doing a range query on an integer field (integer_field:[1 TO 400]) brings back weird results like 4000 and so on.
Also, I am very limited by lucene cause I can't use leading wildcards and other stuff.

Now, I can have far better results if I add a Criteria object to the fullTextSession but I have seen in a forum someone saying that these criteria should not be constrained - just provide a different fetching mechanism.

So, can I use the Criteria API to make my queries? And if so, then what should I give to fullTextSession.createFullTextQuery for a query ???? I mean, constructing a lucene.search.Query with only queries that can go in a lucene.search.Query and use a hibernate.Criteria for all other queries doesn't seem to me so clear. Also, if I make a minimal lucene.search.Query and use the Criteria for all my restrictions does that mean that I bypass the hibernate-Search or Lucene features?

Can you please advise me here?

In general: what are the alternatives to manually building the strings ?


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

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.