QueryParser parser = new MultiFieldQueryParser(
TestConstants.getTargetLuceneVersion(),
new String[] { "name", "physicalDescription", "suspectCharge" },
TestConstants.standardAnalyzer
);
FullTextQuery query = getQuery( "John Doe", parser, s );
assertTrue( query.getResultSize() != 0 );
query = getQuery( "green", parser, s );
random.nextInt( query.getResultSize() - 15 );
query.setFirstResult( random.nextInt( query.getResultSize() - 15 ) );
query.setMaxResults( 10 );
query.list();
tx.commit();
s.close();
s = sf.openSession();
tx = s.beginTransaction();
query = getQuery( "John Doe", parser, s );
assertTrue( query.getResultSize() != 0 );
query = getQuery( "thief", parser, s );
int firstResult = random.nextInt( query.getResultSize() - 15 );
query.setFirstResult( firstResult );
query.setMaxResults( 10 );
List result = query.list();
Object object = result.get( 0 );
if ( insert && object instanceof Detective ) {
Detective detective = (Detective) object;
detective.setPhysicalDescription(
detective.getPhysicalDescription() + " Eye"