airborne12 commented on code in PR #67918:
URL: https://github.com/apache/doris/pull/67918#discussion_r4079410312
##########
fe/fe-core/src/main/java/org/apache/doris/analysis/invertedindex/AnalyzerIdentityBuilder.java:
##########
@@ -206,17 +900,21 @@ private static String resolveTokenFilterIdentity(String
filterList) {
String[] filters = filterList.split(",\\s*");
// DO NOT sort - filter order is semantically significant
- for (int i = 0; i < filters.length; i++) {
- String filter = filters[i].trim();
- if (i > 0) {
- sb.append(",");
+ String previous = null;
+ for (String filterName : filters) {
+ String filter = resolveComponentIdentity(filterName.trim(),
IndexPolicyTypeEnum.TOKEN_FILTER);
+ if (Strings.isNullOrEmpty(filter)) {
+ continue;
}
-
- if (IndexPolicy.BUILTIN_TOKEN_FILTERS.contains(filter)) {
- sb.append(filter);
- } else {
- sb.append(resolveComponentIdentity(filter,
IndexPolicyTypeEnum.TOKEN_FILTER));
+ // Repeating an idempotent filter leaves the terms, offsets and
provenance unchanged.
+ if (filter.equals(previous) &&
IDEMPOTENT_TOKEN_FILTERS.contains(filter)) {
Review Comment:
Confirmed in BE: default ASCII folding either leaves a code point unchanged
or maps it to ASCII; a second pass leaves terms and delegated provenance
unchanged. Commit 0e06be4 collapses adjacent canonical bare `asciifolding`
filters. The test retains `preserve_original=true` as a negative and
`AnalyzerIdentityBuilderTest` passed (53 tests).
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]