// adds fetch variables to the transform function
if ("*".equals(fetchVariables) || "true".equalsIgnoreCase(fetchVariables)) {
transformFunction = new Function<ScoredMatch, SearchResult>() {
@Override
public SearchResult apply(ScoredMatch scoredMatch) {
SearchResult searchResult = baseTransform.apply(scoredMatch);
searchResult.setVariables(boostsManager.getVariablesAsMap(scoredMatch.getDocId()));
return searchResult;
}
};
}
// adds fetch categories to the transform function
final Function<ScoredMatch, SearchResult> prevTransform = transformFunction;
if ("*".equals(fetchCategories) || "true".equalsIgnoreCase(fetchCategories)) {
transformFunction = new Function<ScoredMatch, SearchResult>() {
@Override
public SearchResult apply(ScoredMatch scoredMatch) {
SearchResult searchResult = prevTransform.apply(scoredMatch);
searchResult.setCategories(boostsManager.getCategoryValues(scoredMatch.getDocId()));
return searchResult;
}
};
}