Remove redundant filtering
@@ -232,7 +232,8 @@ public class SearchBuilder {
new FieldOperationApplier().process(sdoc);
}
- resolveDocumentReferences();
+ DocumentReferenceResolver resolver = new DocumentReferenceResolver(searchList);
+ sdocs.forEach(resolver::resolveReferences);
DocumentModelBuilder builder = new DocumentModelBuilder(model);
for (Search search : new SearchOrderer().order(searchList)) {
@@ -249,14 +250,6 @@ public class SearchBuilder {
isBuilt = true;
}
- private void resolveDocumentReferences() {
- DocumentReferenceResolver resolver = new DocumentReferenceResolver(searchList);
- searchList.stream()
- .filter(Search::hasDocument)
- .map(Search::getDocument)
- .forEach(resolver::resolveReferences);
- }
-
/**
* Processes and returns the given {@link Search} object. This method has been factored out of the {@link
* #build()} method so that subclasses can choose not to build anything.
