-->
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: Hibernate Search Pagination problem
PostPosted: Mon Jun 17, 2013 4:04 pm 
Newbie

Joined: Mon Jun 17, 2013 3:50 pm
Posts: 1
i need to retrieve the search result with any of three columns matched i have two method one is for count another one is for pagination but pagination method is not retrieving the result properly .i don know what mistake i did following is my code please correct me the mistakes

count method: for example total count is 25
FullTextSession fullTextSession = Search.getFullTextSession(session);
final QueryBuilder b = fullTextSession.getSearchFactory()
.buildQueryBuilder().forEntity(JobDetails.class).get();
org.apache.lucene.search.Query luceneQuery = b.keyword()
.onFields("jobId", "technology", "skills")
.matching(searchKey).createQuery();
int result= fullTextSession
.createFullTextQuery(luceneQuery).list().size();
System.out.println("result:"+result);

pagination Method : : for example first result is : 0 max result is :20
FullTextSession fullTextSession = Search.getFullTextSession(session);
final QueryBuilder b = fullTextSession.getSearchFactory()
.buildQueryBuilder().forEntity(JobDetails.class).get();
org.apache.lucene.search.Query luceneQuery = b.keyword()
.onFields("jobId", "technology", "skills")
.matching(searchKey).createQuery();
List<JobDetails> result = (List<JobDetails>)fullTextSession
.createFullTextQuery(luceneQuery)
.setFirstResult(firstResult)
.setMaxResults(maxResults).list();

System.out.println("Search job result size:"+result.size());

the expected result for the second pagination method for first page is 20 and second page is remaining 5 but its returning only 17 on first page so whats the problem :( please help me


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.