-->
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.  [ 2 posts ] 
Author Message
 Post subject: Hibernate Search Paging + Full Text Search + Criteria
PostPosted: Sat Feb 20, 2010 7:08 am 
Newbie

Joined: Sat Feb 20, 2010 7:00 am
Posts: 1
I am trying to do a search with some criteria

Code:
FullTextQuery fullTextQuery = fullTextSession.createFullTextQuery(finalQuery, KnowledgeBaseSolution.class).setCriteriaQuery(criteria);


and then page it

Code:
//Gives me around 700 results
result.setResultCount(fullTextQuery.getResultSize());
//Some pages are empty
fullTextQuery.setFirstResult(( (pageNumber - 1) * pageSize ));
fullTextQuery.setMaxResults( pageSize );
result.setResults(fullTextQuery.list());


I suspect Lucene return full result of the full text search without taking the criteria into account and then hibernate search applies the criteria after, therefore some page are empty (after filtering by criteria)

What is proper way to do fullTextSearch with some criteria, is it possible to apply the criteria before the lucene search?

Or do I have to use pure Lucene (if so what's the point of Hibernate Search?)

(I found this post, is this still true that paging is not supported? viewtopic.php?t=980849&highlight=hibernate+search+pagination)

Thanks in advance


Top
 Profile  
 
 Post subject: Re: Hibernate Search Paging + Full Text Search + Criteria
PostPosted: Mon Feb 22, 2010 8:33 am 
Hibernate Team
Hibernate Team

Joined: Thu Apr 05, 2007 5:52 am
Posts: 1689
Location: Sweden
Hi,

pagination is supported, just not in the combined case of Criteria + Search query.
The solution to your problem would be to index all data relevant for the search using Hibernate Search annotations. Then you write your query completely as Lucene query. The point here is that even though you are doing a Lucene query you are getting Hibernate managed objects back. Also using the mapping annotations you don't have to write any boiler plate code to map between index and object world.

--Hardy


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 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.