This is an automated email from the ASF dual-hosted git repository.
spmallette pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tinkerpop.git
The following commit(s) were added to refs/heads/master by this push:
new 7a836a6358 Expand the Filter Step reference documentation
7a836a6358 is described below
commit 7a836a635825514af50022494e46f3262f3a882b
Author: Stephen Mallette <[email protected]>
AuthorDate: Thu Aug 13 13:34:50 2026 +0000
Expand the Filter Step reference documentation
The Filter Step reference section was a single-sentence stub. This adds a
description of the pass-through contract for filter()'s child traversal (a
child traversal that emits one or more results passes the traverser; an
empty
child result drops it) along with a runnable modern-graph example. It also
corrects the Additional References link text, which read "map(Traversal)"
even though the link targets the filter() method.
Assisted-by: Kiro:claude-opus-4.8
---
docs/src/reference/the-traversal.asciidoc | 15 ++++++++++++++-
1 file changed, 14 insertions(+), 1 deletion(-)
diff --git a/docs/src/reference/the-traversal.asciidoc
b/docs/src/reference/the-traversal.asciidoc
index 0c6792c0bf..1fb1338b0a 100644
--- a/docs/src/reference/the-traversal.asciidoc
+++ b/docs/src/reference/the-traversal.asciidoc
@@ -2179,9 +2179,22 @@ The `filter()` step maps the traverser from the current
object to either `true`
pass the traverser to the next step in the process. Please see the
<<general-steps, General Steps>> section for more
information.
+`filter()` accepts a child traversal and uses a simple pass-through contract
to decide the outcome for each incoming
+traverser: if the child traversal emits one or more results, it evaluates to
`true` and the traverser is passed to the
+next step; if the child traversal emits nothing, it evaluates to `false` and
the traverser is dropped.
+
+[gremlin-groovy,modern]
+----
+g.V().filter(out('knows').has('name','josh')).values('name') <1>
+----
+
+<1> Find the vertices who "know" josh. The child traversal
`out('knows').has('name','josh')` emits a result only for
+marko (the one vertex with a `knows` edge to josh), so only that traverser
evaluates to `true` and passes through
+`filter()`; every other vertex produces an empty child result, evaluates to
`false`, and is dropped.
+
*Additional References*
-link:++https://tinkerpop.apache.org/javadocs/x.y.z/core/org/apache/tinkerpop/gremlin/process/traversal/dsl/graph/GraphTraversal.html#filter(org.apache.tinkerpop.gremlin.process.traversal.Traversal)++[`map(Traversal)`]
+link:++https://tinkerpop.apache.org/javadocs/x.y.z/core/org/apache/tinkerpop/gremlin/process/traversal/dsl/graph/GraphTraversal.html#filter(org.apache.tinkerpop.gremlin.process.traversal.Traversal)++[`filter(Traversal)`]
[llms-summary="The flatMap() step maps the traverser from the current object
to an Iterator of objects for the next step in the process."]
[[flatmap-step]]