~pbeaman/akiban-server/use-persistit-3.3.0

« back to all changes in this revision

Viewing changes to src/main/java/com/akiban/server/service/text/FullTextCursor.java

merge mmcm: Address the recent test failures due to unpredictable ordering returned by full text queries.

https://code.launchpad.net/~mmcm/akiban-server/full-text-search-sort/+merge/160960

Show diffs side-by-side

added added

removed removed

Lines of Context:
35
35
import org.apache.lucene.search.Query;
36
36
import org.apache.lucene.search.ScoreDoc;
37
37
import org.apache.lucene.search.SearcherManager;
 
38
import org.apache.lucene.search.Sort;
 
39
import org.apache.lucene.search.SortField;
38
40
import org.apache.lucene.search.TopDocs;
39
41
import org.apache.lucene.util.BytesRef;
40
42
 
55
57
    private TopDocs results;
56
58
    private int position;
57
59
 
 
60
    public static final Sort SORT = new Sort(SortField.FIELD_SCORE,
 
61
                                             new SortField(IndexedField.KEY_FIELD,
 
62
                                                           SortField.Type.STRING));
 
63
 
58
64
    private static final Logger logger = LoggerFactory.getLogger(FullTextCursor.class);
59
65
 
60
66
    public FullTextCursor(QueryContext context, HKeyRowType rowType, 
78
84
        }
79
85
        else {
80
86
            try {
81
 
                results = searcher.search(query, limit);
 
87
                results = searcher.search(query, limit, SORT);
82
88
            }
83
89
            catch (IOException ex) {
84
90
                throw new AkibanInternalException("Error searching index", ex);