I use lucene. I indexed documents with two fields. First field is name and second field is count. I use this index for autocomplete. I need find 10 names by prefix and the higest count.
I use code like this :
But it doesn't work . I get unsorted results.Code:
Sort sort = new Sort(new SortField("countfieldname", SortField.INT,true));
PrefixQuery pq = new PrefixQuery(new Term("namefieldname", "prefix"));