[hibernate-issues] [Hibernate-JIRA] Resolved: (HSEARCH-753) Raise exception when there is a risk of having fullTextQuery.getResultList().size() != fullTextQuery.getResultSize()
Sanne Grinovero (JIRA)
noreply at atlassian.com
Tue Aug 30 14:54:02 EDT 2011
[ http://opensource.atlassian.com/projects/hibernate/browse/HSEARCH-753?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Sanne Grinovero resolved HSEARCH-753.
-------------------------------------
Resolution: Fixed
> Raise exception when there is a risk of having fullTextQuery.getResultList().size() != fullTextQuery.getResultSize()
> --------------------------------------------------------------------------------------------------------------------
>
> Key: HSEARCH-753
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HSEARCH-753
> Project: Hibernate Search
> Issue Type: Bug
> Components: query
> Affects Versions: 3.4.0.Final
> Environment: hibernate 3.6.4.Final / postgresSQL
> Reporter: Mathieu Perez
> Assignee: Emmanuel Bernard
> Fix For: 4.0.0.Alpha2
>
> Attachments: ResultSizeOnCriteria.java, Tractor.java
>
>
> 1) My indexes are up-to-date and optimised
> 2) I'm aware about this part of documentation: "Like Google, the number of results is approximative if the index is not fully up-to-date with the database (asynchronous cluster for example)."
> 3) Two types of queries:
> 3.1) Query with "keyword" (or "below"/"above"/"fromTo")
> {code}
> QueryBuilder qb = fullTextSession.getSearchFactory().buildQueryBuilder().forEntity( Book.class ).get();
> org.apache.lucene.search.Query query = qb
> .keyword()
> .onFields("title", "subtitle", "authors.name", "publicationDate")
> .matching("Java rocks!");
> .createQuery();
> {code}
> In this case, I don't meet any problem:
> query.getResultSize() == query.getResultList().size()
> 3.2) Query with criteria
> {code}
> Criteria criteria = s.createCriteria( Book.class ).createCriteria('isbn').add(Restrictions.like('XXXXXX'))
> Query q = s.createFullTextQuery( luceneQuery ).setCriteriaQuery( criteria );
> {code}
> In this case, the result is different:
> {code}
> query.getResultSize() != query.getResultList().size()
> {code}
> Actually, query.getResultSize() exactly returns the number of Book contained in my Book's table. (select count(*) from Book;) without taking in consideration my criteria.
> I don't known if it's really a bug either it's the expected behaviour.
> When inspecting the org.hibernate.search.query.engine.impl.HSQueryImpl java class, I realized that
> {code}
> QueryHits queryHits = getQueryHits( searcher, 0 ) :
> {code}
> - 3.1) Takes in charge my keyword
> - 3.2) Doesn't seem to use my criteria
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the hibernate-issues
mailing list