Organizational Research By

Surprising Reserch Topic

how to Hibernate Search FullTextQuery getResultSize never matches getResultList().size()?


Does anyone have a clue why Hibernate Search FullTextQuery (FullTextEntityManager) getResultSize() never matches the getResultList().size()?

I am not passing anything to setFirstResult or setMaxResult.

For example, I do a query on one field for the word "truck" the resultSize says 50,345, but the ResultList.size() is 865. Does anyone know of any reason these would be so far off? I have cleared the Lucene indexes and rebuilt them, but it still doesn't work. I am baffled.

    QueryBuilder qb = this.inventoryRepo.getSearchManager()
                .getSearchFactory().buildQueryBuilder()
                .forEntity(Inventory.class).get();

         BooleanJunction junction = this.builder.createAlgorithm(
                    searchRequest, qb);

         org.apache.lucene.search.Query luceneQueryluceneQuery = junction.createQuery();

        }

        searchResult.setQuery(luceneQuery.toString());


        FullTextQuery jpaQuery = this.inventoryRepo.getSearchManager()
                .createFullTextQuery(luceneQuery, Inventory.class);

        jpaQuery.limitExecutionTimeTo(20000,
                TimeUnit.MILLISECONDS);

        List results = jpaQuery.getResultList();

        log.debug("Total Search Result Size: " + jpaQuery.getResultSize());
        searchResult.setTotalSize(jpaQuery.getResultSize());
asked May 16, 2015 in hibernate by rajesh
0 votes
28 views



Related Hot Questions



Government Jobs Opening


...