Skip to content

Commit a97bbc4

Browse files
committed
Fix bug introduced while moving to all shared args
1 parent ad728f3 commit a97bbc4

File tree

2 files changed

+4
-14
lines changed

2 files changed

+4
-14
lines changed

x-pack/plugin/mapper-patterned-text/src/main/java/org/elasticsearch/xpack/patternedtext/PatternedTextDocValues.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,6 @@ static PatternedTextDocValues from(LeafReader leafReader, String templateFieldNa
3636
}
3737

3838
SortedSetDocValues argsDocValues = DocValues.getSortedSet(leafReader, argsFieldName);
39-
40-
assert templateDocValues.getValueCount() <= 1;
41-
assert argsDocValues.getValueCount() <= 1;
4239
return new PatternedTextDocValues(templateDocValues, argsDocValues);
4340
}
4441

@@ -61,7 +58,10 @@ String lookupOrdAsString(long l) throws IOException {
6158
String template = templateDocValues.lookupOrd(l).utf8ToString();
6259
int argsCount = PatternedTextValueProcessor.countArgs(template);
6360
List<String> args = new ArrayList<>(argsCount);
64-
PatternedTextValueProcessor.addRemainingArgs(args, argsDocValues.lookupOrd(argsDocValues.nextOrd()).utf8ToString());
61+
if (argsCount > 0) {
62+
var mergedArgs = argsDocValues.lookupOrd(argsDocValues.nextOrd());
63+
PatternedTextValueProcessor.addRemainingArgs(args, mergedArgs.utf8ToString());
64+
}
6565
return PatternedTextValueProcessor.merge(new PatternedTextValueProcessor.Parts(template, args, null));
6666
}
6767

x-pack/plugin/mapper-patterned-text/src/main/java/org/elasticsearch/xpack/patternedtext/PatternedTextValueProcessor.java

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,6 @@ public class PatternedTextValueProcessor {
1717
private static final String SPACE = " ";
1818

1919
record Parts(String template, List<String> args, String indexed) {
20-
String templateStripped() {
21-
List<String> stripped = new ArrayList<>();
22-
String[] parts = template.split(SPACE);
23-
for (String part : parts) {
24-
if (part.startsWith("%") == false) {
25-
stripped.add(part);
26-
}
27-
}
28-
return String.join(SPACE, stripped);
29-
}
3020
}
3121

3222
static Parts split(String text) {

0 commit comments

Comments
 (0)