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
|