Skip to content

Commit 2a58a6e

Browse files
committed
Fix some docs issues
1 parent 3248b8f commit 2a58a6e

File tree

7 files changed

+53
-39
lines changed

7 files changed

+53
-39
lines changed

docs/reference/esql/functions/functionNamedParams/match.asciidoc

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/reference/esql/functions/kibana/definition/match.json

Lines changed: 29 additions & 29 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/reference/esql/functions/layout/match.asciidoc

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/reference/esql/functions/parameters/match.asciidoc

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/EsqlFunctionRegistry.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -591,6 +591,10 @@ public List<String> argNames() {
591591
public List<String> argDescriptions() {
592592
return args.stream().map(ArgSignature::description).toList();
593593
}
594+
595+
public List<Boolean> argOptionals() {
596+
return args.stream().map(ArgSignature::optional).toList();
597+
}
594598
}
595599

596600
/**

x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/fulltext/Match.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -182,9 +182,14 @@ public Match(
182182
name = "operator",
183183
type = "keyword",
184184
valueHint = { "AND", "OR" },
185-
description = "Boolean logic used to interpret text in the query value"
185+
description = "Boolean logic used to interpret text in the query value."
186+
),
187+
@MapParam.MapParamEntry(
188+
name = "prefix_length",
189+
type = "integer",
190+
valueHint = { "1" },
191+
description = "Number of beginning characters left unchanged for fuzzy matching."
186192
),
187-
@MapParam.MapParamEntry(name = "prefix_length", valueHint = { "1" }, description = ""),
188193
@MapParam.MapParamEntry(
189194
name = "zero_terms_query",
190195
type = "keyword",

x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/function/AbstractFunctionTestCase.java

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -928,7 +928,7 @@ protected static void renderDocs(String name) throws IOException {
928928
);
929929
}
930930
renderTypes(name, description.args());
931-
renderParametersList(name, description.argNames(), description.argDescriptions());
931+
renderParametersList(name, description.argNames(), description.argDescriptions(), description.argOptionals());
932932
FunctionInfo info = EsqlFunctionRegistry.functionInfo(definition);
933933
renderDescription(name, description.description(), info.detailedDescription(), info.note());
934934
Optional<EsqlFunctionRegistry.ArgSignature> mapArgSignature = description.args()
@@ -1007,12 +1007,17 @@ private static void renderTypes(String name, List<EsqlFunctionRegistry.ArgSignat
10071007
writeToTempDir("types", name, "asciidoc", rendered);
10081008
}
10091009

1010-
private static void renderParametersList(String name, List<String> argNames, List<String> argDescriptions) throws IOException {
1010+
private static void renderParametersList(String name, List<String> argNames, List<String> argDescriptions, List<Boolean> argsOptional)
1011+
throws IOException {
10111012
StringBuilder builder = new StringBuilder();
10121013
builder.append(DOCS_WARNING);
10131014
builder.append("*Parameters*\n");
10141015
for (int a = 0; a < argNames.size(); a++) {
1015-
builder.append("\n`").append(argNames.get(a)).append("`::\n").append(argDescriptions.get(a)).append('\n');
1016+
builder.append("\n`").append(argNames.get(a)).append("`::\n");
1017+
if (argsOptional.get(a)) {
1018+
builder.append("(Optional) ");
1019+
}
1020+
builder.append(argDescriptions.get(a)).append('\n');
10161021
}
10171022
String rendered = builder.toString();
10181023
LogManager.getLogger(getTestClass()).info("Writing parameters for [{}]:\n{}", name, rendered);
@@ -1127,7 +1132,7 @@ private static void renderFullLayout(String name, boolean preview, boolean hasEx
11271132
.replace("$UPPER_NAME$", name.toUpperCase(Locale.ROOT))
11281133
.replace("$PREVIEW_CALLOUT$", preview ? PREVIEW_CALLOUT : "");
11291134
if (hasFunctionOptions) {
1130-
rendered += "include::../optionalFunctionParams/" + name + ".asciidoc[]\n";
1135+
rendered += "include::../functionNamedParams/" + name + ".asciidoc[]\n";
11311136
}
11321137
if (hasExamples) {
11331138
rendered += "include::../examples/" + name + ".asciidoc[]\n";

0 commit comments

Comments
 (0)