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 ?
|