-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: Hibernate Search pagination setMaxResults
PostPosted: Tue May 06, 2008 4:30 am 
Newbie

Joined: Mon May 15, 2006 10:30 am
Posts: 7
Hibernate version:
Core 3.2.6 GA
Search 3.0.1 GA

Name and version of the database you are using:
MySQL 5.0.27

The problem is when I run the code below it returns 32 results. So far so good. But when I add pagination in the form of 'criteria.setMaxResults()' it starts to return weird results.

When I set it to:
30 it returns 26 results.
40 it returns 27 results.
50 it returns 32 results.

When I set first result on 20 and max on 50 it returns 27 results.

What is going on here?

Code:
Session session = getSession();
      FullTextSession fullTextSession = Search.createFullTextSession(session);

      Transaction tx = fullTextSession.beginTransaction();

      MultiFieldQueryParser parser = new MultiFieldQueryParser( new String[]{"title", "description"},
        new StandardAnalyzer());
      
      Query query = null;
      try {
         query = parser.parse( "my keyword" );
      } catch (ParseException e) {
         e.printStackTrace();
      }
      FullTextQuery hibQuery = fullTextSession.createFullTextQuery( query, MyClass.class );
      
      Criteria criteria = session.createCriteria(MyClass.class);
      criteria.createAlias("myManyToManyRelation", "mm");
      criteria.add(Restrictions.in("mm.id", new Object[] {new Long(11969), new Long(11970)}));


      hibQuery.setCriteriaQuery(criteria);
      List<MyClass> result = hibQuery.list();

      tx.commit();
      session.close();


Top
 Profile  
 
 Post subject: Re: Hibernate Search pagination setMaxResults
PostPosted: Sat Oct 26, 2013 5:38 am 
Newbie

Joined: Mon Dec 24, 2012 6:32 am
Posts: 17
I am having a similar issue.
I am not doing Criteria query, just a full text query. Sometimes it returns results less than the max results although there are more results.

_________________
Sourabh Ghorpade


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.