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

Mathieu Perez (JIRA) noreply at atlassian.com
Thu May 12 12:35:24 EDT 2011


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


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.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the hibernate-issues mailing list