[hibernate-issues] [Hibernate-JIRA] Assigned: (HSEARCH-753) fullTextQuery.getResultList().size() != fullTextQuery.getResultSize() when using criteria

Sanne Grinovero (JIRA) noreply at atlassian.com
Wed Aug 3 08:03:04 EDT 2011


     [ http://opensource.atlassian.com/projects/hibernate/browse/HSEARCH-753?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Sanne Grinovero reassigned HSEARCH-753:
---------------------------------------

    Assignee: Emmanuel Bernard

Seems you have it quite clear how you want this to be implemented.

> fullTextQuery.getResultList().size() != fullTextQuery.getResultSize() when using criteria
> -----------------------------------------------------------------------------------------
>
>                 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.Alpha1
>
>         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