Search { public Set<String> postProcessingFields() { Set<String> fields = new LinkedHashSet<>(); query.forEach(condition -> fields.addAll(condition.postProcessingFields())); sort.forEach(condition -> fields.addAll(condition.postProcessingFields())); return fields; } 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 testPostProcessingFields() { assertEquals("postProcessingFields is wrong", Sets.newHashSet("f2", "f3.f1", "f3.f2", "f3.f3"), search().filter(match("f1", 1)) .query(match("f2", 1)) .query(bool().must(match("f3.f1", 1)) .must(match("f3.f2", 1)) .should(match("f3.f3", 1)) .not(match("f3.f4", 1))) .build() .postProcessingFields()); }