Hello everyone!
I'm using Projection to search on an index with +/-6 millions records. When I don't sort the result, everything works fine. When I try to sort the result, I get an OutOfMemoryException.
The code is:
Code:
FullTextQuery fullTextQuery = fullTextEntityManager.createFullTextQuery(query, Record.class);
Sort sort = new Sort(new SortField("titles_store", 3,true));
fullTextQuery.setSort(sort);
fullTextQuery.setFirstResult(0);
fullTextQuery.setMaxResults(10);
/* some faceting request */
List resultProjection = fullTextQuery.setProjection("id","titles_store","descriptions_store","creators_store","dates","link","imageLink_store","archive.name","archive.homePageUrl").getResultList();
Without the lines
Code:
Sort sort = new Sort(new SortField("titles_store", 3,true));
fullTextQuery.setSort(sort);
, everything works fine.
With the lines
Code:
Sort sort = new Sort(new SortField("titles_store", 3,true));
fullTextQuery.setSort(sort);
, the getResultList() call throws an OutOfMemoryException...
The facets are not the problem (when disabled, the OutOfMemoryError occurs).
The query is a little complex, but I don't think it's the reason of the OutOfMemoryError (without sorting, with the same query, i get the results in less than a second...)
It seems that when using projection, the maxResults limit is not used and all the records are returned... I'm using Hibernate Search 3.4.2 Final. Any ideas?