Search { public boolean usesSorting() { return !sort.isEmpty(); } Search(List<Condition> filter,
                  List<Condition> query,
                  List<SortField> sort,
                  IndexPagingState paging,
                  Boolean refresh); boolean requiresPostProcessing(); boolean requiresFullScan(); boolean usesRelevance(); boolean usesSorting(); boolean isEmpty(); Query query(Schema schema, Query range); Query postProcessingQuery(Schema schema); boolean refresh(); List<org.apache.lucene.search.SortField> sortFields(Schema schema); IndexPagingState paging(); Set<String> postProcessingFields(); Search validate(Schema schema); @Override String toString(); final List<Condition> filter; final List<Condition> query; }
@Test public void testUsesSorting() { assertFalse("Use sorting is wrong", filter(MATCH).build().usesSorting()); assertFalse("Use sorting is wrong", query(MATCH).build().usesSorting()); assertTrue("Use sorting is wrong", sort(FIELD).build().usesSorting()); assertTrue("Use sorting is wrong", search().filter(match("field", "v")) .query(match("field", "v")) .sort(field("field")) .build() .usesRelevance()); }