Search { public boolean usesRelevance() { return !query.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 testUsesRelevance() { assertFalse("Use relevance is wrong", filter(MATCH).build().usesRelevance()); assertTrue("Use relevance is wrong", query(MATCH).build().usesRelevance()); assertFalse("Use relevance is wrong", sort(FIELD).build().usesRelevance()); assertTrue("Use relevance is wrong", filter(MATCH).query(MATCH).sort(FIELD).build().usesRelevance()); assertTrue("Use relevance is wrong", query(MATCH).sort(FIELD).build().usesRelevance()); assertFalse("Use relevance is wrong", filter(MATCH).sort(FIELD).build().usesRelevance()); }