hi,
i had class that is
Code:
@Index
public class User
{
@Fields({@Field(index=Index.TOKENIZED),
@Field(index=Index.UN_TOKENIZED, name="email_sort", store=Store.YES)})
private String email;
// other .....
}
and i got a Query to sort the field base on multiple field (in a JUnit test case)
Code:
MultiFieldQueryParser parser = new MultiFieldQueryParser(
new String[]{
"email", "fax"}, new StandardAnalyzer());
Query query = parser.parse( "u*" );
hibQuery = fullTextSession.createFullTextQuery( query, User.class );
Sort sort = new Sort(new SortField("email", false));
hibQuery.setSort(sort);
List<User> result = hibQuery.list();
note that the SortField could be true or false base on user input.
My problem is something when i run the test case, SOMETIMES I got this exception :
Code:
java.lang.RuntimeException: there are more terms than documents in field "email", but it's impossible to sort on tokenized fields
at org.apache.lucene.search.FieldCacheImpl$10.createValue(FieldCacheImpl.java:379)
at org.apache.lucene.search.FieldCacheImpl$Cache.get(FieldCacheImpl.java:72)
....
but something is working ok.
any idea ?
kiwi