Skip to content

Commit 258e31c

Browse files
Support depthOffset in MD docs headings for nesting functions (#126984) (#127092)
While this change appears subtle at this point, I am using this in a later PR that adds a lot more spatial functions, where nesting them in related groups like this looks much better. The main impact of this is that the On this page navigator on the right panel of the docs will show the nesting Co-authored-by: Liam Thompson <[email protected]>
1 parent 99e4631 commit 258e31c

File tree

11 files changed

+35
-23
lines changed

11 files changed

+35
-23
lines changed

docs/reference/query-languages/esql/_snippets/functions/layout/st_xmax.md

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/query-languages/esql/_snippets/functions/layout/st_xmin.md

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/query-languages/esql/_snippets/functions/layout/st_ymax.md

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/query-languages/esql/_snippets/functions/layout/st_ymin.md

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/query-languages/esql/_snippets/lists/spatial-functions.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* [`ST_X`](../../functions-operators/spatial-functions.md#esql-st_x)
77
* [`ST_Y`](../../functions-operators/spatial-functions.md#esql-st_y)
88
* [preview] [`ST_ENVELOPE`](../../functions-operators/spatial-functions.md#esql-st_envelope)
9-
* [preview] [`ST_XMAX`](../../functions-operators/spatial-functions.md#esql-st_xmax)
10-
* [preview] [`ST_XMIN`](../../functions-operators/spatial-functions.md#esql-st_xmin)
11-
* [preview] [`ST_YMAX`](../../functions-operators/spatial-functions.md#esql-st_ymax)
12-
* [preview] [`ST_YMIN`](../../functions-operators/spatial-functions.md#esql-st_ymin)
9+
* [preview] [`ST_XMAX`](../../functions-operators/spatial-functions.md#esql-st_xmax)
10+
* [preview] [`ST_XMIN`](../../functions-operators/spatial-functions.md#esql-st_xmin)
11+
* [preview] [`ST_YMAX`](../../functions-operators/spatial-functions.md#esql-st_ymax)
12+
* [preview] [`ST_YMIN`](../../functions-operators/spatial-functions.md#esql-st_ymin)

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,12 @@
7070
*/
7171
String appendix() default "";
7272

73+
/**
74+
* Adjusts documentation heading level (0=standard, 1=subheading, etc).
75+
* Used to create logical nesting between related functions.
76+
*/
77+
int depthOffset() default 0;
78+
7379
/**
7480
* The position the function can appear in the language.
7581
*/

x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/scalar/spatial/StXMax.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,8 @@ public class StXMax extends UnaryScalarFunction {
4545
returnType = "double",
4646
description = "Extracts the maximum value of the `x` coordinates from the supplied geometry.\n"
4747
+ "If the geometry is of type `geo_point` or `geo_shape` this is equivalent to extracting the maximum `longitude` value.",
48-
examples = @Example(file = "spatial_shapes", tag = "st_x_y_min_max")
48+
examples = @Example(file = "spatial_shapes", tag = "st_x_y_min_max"),
49+
depthOffset = 1 // So this appears as a subsection of ST_ENVELOPE
4950
)
5051
public StXMax(
5152
Source source,

x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/scalar/spatial/StXMin.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,8 @@ public class StXMin extends UnaryScalarFunction {
4545
returnType = "double",
4646
description = "Extracts the minimum value of the `x` coordinates from the supplied geometry.\n"
4747
+ "If the geometry is of type `geo_point` or `geo_shape` this is equivalent to extracting the minimum `longitude` value.",
48-
examples = @Example(file = "spatial_shapes", tag = "st_x_y_min_max")
48+
examples = @Example(file = "spatial_shapes", tag = "st_x_y_min_max"),
49+
depthOffset = 1 // So this appears as a subsection of ST_ENVELOPE
4950
)
5051
public StXMin(
5152
Source source,

x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/scalar/spatial/StYMax.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,8 @@ public class StYMax extends UnaryScalarFunction {
4545
returnType = "double",
4646
description = "Extracts the maximum value of the `y` coordinates from the supplied geometry.\n"
4747
+ "If the geometry is of type `geo_point` or `geo_shape` this is equivalent to extracting the maximum `latitude` value.",
48-
examples = @Example(file = "spatial_shapes", tag = "st_x_y_min_max")
48+
examples = @Example(file = "spatial_shapes", tag = "st_x_y_min_max"),
49+
depthOffset = 1 // So this appears as a subsection of ST_ENVELOPE
4950
)
5051
public StYMax(
5152
Source source,

x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/scalar/spatial/StYMin.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,8 @@ public class StYMin extends UnaryScalarFunction {
4545
returnType = "double",
4646
description = "Extracts the minimum value of the `y` coordinates from the supplied geometry.\n"
4747
+ "If the geometry is of type `geo_point` or `geo_shape` this is equivalent to extracting the minimum `latitude` value.",
48-
examples = @Example(file = "spatial_shapes", tag = "st_x_y_min_max")
48+
examples = @Example(file = "spatial_shapes", tag = "st_x_y_min_max"),
49+
depthOffset = 1 // So this appears as a subsection of ST_ENVELOPE
4950
)
5051
public StYMin(
5152
Source source,

0 commit comments

Comments
 (0)