Hibernate Search Paging + FullTextSearch + Criteria
I am trying to do a search with some criteria
FullTextQuery fullTextQuery = fullTextSession.createFullTextQuery(finalQuery, KnowledgeBaseSolution.class).setCriteriaQuery(criteria);
and then page it
//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开发者_JS百科, 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?)
Thanks in advance
Apparently you cannot use fullTextSearch and criteria and paging/sorting together. Unless you go to the Lucene level
link text
精彩评论