English 中文(简体)
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, 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

问题回答

暂无回答




相关问题
Lucene.NET in medium trust

How do I make Lucene.NET 2.3.2 run in a medium trust environment? GoDaddy doesn t like it the way it is.

Grails searchable plugin

In my Grails app, I m using the Searchable plugin for searching/indexing. I want to write a Compass/Lucene query that involves multiple domain classes. Within that query when I want to refer to the id ...

Search subset of objects using Compass/Lucene

I m using the searchable plugin for Grails (which provides an API for Compass, which is itself an API over Lucene). I have an Order class that I would like to search but, I don t want to search all ...

Lucene seems to be caching search results - why?

In my project we use Lucene 2.4.1 for fulltext search. This is a J2EE project, IndexSearcher is created once. In the background, the index is refreshed every couple of minutes (when the content ...

热门标签