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();