...
|
...
|
@@ -838,8 +838,21 @@ public class SearchExplainerService { |
|
|
searchFieldResult.setFieldValue(document.get(analyzeFields.get(i).field).toString());
|
|
|
List<String> tokens = tokensGroupList.get(i);
|
|
|
searchFieldResult.setTokens(Arrays.asList(StringUtils.join(tokens, ";")));
|
|
|
List<String> matchTokens = keywordSearchAnalyzesMap.get(analyzeFields.get(i).search_analyzer).stream().filter(kt -> tokens.contains(kt.getTerm())).map(AnalyzeResponse.AnalyzeToken::getTerm).collect(Collectors.toList());
|
|
|
searchFieldResult.addAllMatchToken(matchTokens);
|
|
|
|
|
|
List<String> keywordtokens;
|
|
|
if (StringUtils.isBlank(analyzeFields.get(i).search_analyzer)) {
|
|
|
keywordtokens = Arrays.asList(keyword);
|
|
|
} else {
|
|
|
List<AnalyzeResponse.AnalyzeToken> keywordSearchAnalyzes = keywordSearchAnalyzesMap.get(analyzeFields.get(i).search_analyzer);
|
|
|
if (CollectionUtils.isNotEmpty(keywordSearchAnalyzes)) {
|
|
|
keywordtokens = keywordSearchAnalyzes.stream().map(AnalyzeResponse.AnalyzeToken::getTerm).collect(Collectors.toList());
|
|
|
} else {
|
|
|
keywordtokens = Arrays.asList(keyword);
|
|
|
}
|
|
|
}
|
|
|
searchFieldResult.setKeywordtokens(Arrays.asList(StringUtils.join(keywordtokens, ";")));
|
|
|
List<String> matchTokens = keywordtokens.stream().filter(t -> tokens.contains(t)).collect(Collectors.toList());
|
|
|
searchFieldResult.addAllMatchToken(Arrays.asList(StringUtils.join(matchTokens, ";")));
|
|
|
searchFieldResult.setMatchResult(CollectionUtils.isNotEmpty(matchTokens));
|
|
|
searchFieldResultList.add(searchFieldResult);
|
|
|
}
|
...
|
...
|
|