Hibernate Search: why .getResultsize is greater than .list().size()? -


the similar question asked not solved. here code

fulltextsession fulltextsession = search.getfulltextsession(currentsession()); querybuilder qb = fulltextsession.getsearchfactory()           .buildquerybuilder().forentity(design.class).get(); org.apache.lucene.search.query query = qb           .keyword()           .onfields("designname", "description")           .matching(text)           .createquery(); org.hibernate.search.fulltextquery hibquery =         fulltextsession.createfulltextquery(query, design.class); hibquery.setfirstresult(start); hibquery.setmaxresults(num);  @suppresswarnings("unchecked") list<design> designlist = hibquery.list(); (design design : designlist) {      hibernate.initialize(design.getdesignimages()); } return designlist; 

why hibquery.list().size() smaller hibquery.getresultsize(). because of difference, .setmaxresults() not work properly.

a reason can index , database not in sync @ time of querying. getresultsize based on lucene query result size whereas list.size() actual size of materialized (loaded) entities.


Comments

Popular posts from this blog

powershell Start-Process exit code -1073741502 when used with Credential from a windows service environment -

twig - Using Twigbridge in a Laravel 5.1 Package -

c# - LINQ join Entities from HashSet's, Join vs Dictionary vs HashSet performance -