First of all you measure for the Lucene time is wrong, there is no call to Lucene at that stage :)
Second, if you are using the latest Hibernate Search version, such a query should be batched for you (how many SQL queries are fired?)
There are several things that might influence the time:
- you have EAGER associations to the object loader, this might trigger some addiitional and useless queries => don't use EAGER, and if you have, check the fullTextQuery.setCriteriaQuery
- you retrieve a lot of objects => use pagination (or potentially scroll), note that you can still retrieve the total number of matching objects using fillTextQuery.getResultSize()
In any case check the SQL queries generated by Hibernate and see what's going on.
_________________ Emmanuel
|