nick-boss-tech commented on code in PR #5356:
URL: https://github.com/apache/solr/pull/5356#discussion_r4636686019


##########
solr/solr-ref-guide/modules/query-guide/pages/other-parsers.adoc:
##########
@@ -494,6 +494,21 @@ The field name in candidate documents to inspect to 
identify incoming graph edge
 +
 An optional query that can be supplied to limit the scope of documents that 
are traversed.
 
+`lookupFilter`::
++
+[%autowidth,frame=none]
+|===
+|Optional |Default: none
+|===
++
+An optional query that limits which documents have their outgoing edges 
followed.
+Documents reached by the traversal (and matching `traversalFilter`, if 
specified) are always collected, but only those that also match `lookupFilter` 
are expanded to find the next level of the graph.
+This also applies to the documents matching the initial query.

Review Comment:
   šŸ¤– *AI text below* šŸ¤–
   
   Could we clarify that `traversalFilter` applies after the root, while 
`lookupFilter` controls expansion even at the root? A root that fails 
`traversalFilter` can still be collected and expanded. I’d also add the root 
query to the file/folder example and say it returns the files and folders 
reachable from that root, subject to `returnRoot` and `returnOnlyLeaf`.



##########
solr/core/src/test/org/apache/solr/search/join/GraphQueryTest.java:
##########
@@ -140,6 +140,76 @@ public void doGraph(SolrParams p) throws Exception {
     assertJQ(
         req(p, "q", "{!graph from=${node_id} to=${edge_id} returnRoot=false 
maxDepth=1}id:doc_1"),
         "/response/numFound==1");
+
+    // lookupFilter: nodes not matching it are collected, but their edges are 
not followed

Review Comment:
   šŸ¤– *AI text below* šŸ¤–
   
   Could we add a case to `TestJsonFacets.testDomainGraph()` using 
`domain.graph.lookupFilter`? The current JSON Facet tests cover 
`traversalFilter`, and these new assertions cover the query parser directly. A 
facet count that includes a reached node but excludes its descendants would 
verify the advertised JSON Facet behavior end to end.



##########
solr/core/src/java/org/apache/solr/search/join/GraphQuery.java:
##########
@@ -193,6 +203,8 @@ private DocSet getDocSet() throws IOException {
       Query frontierQuery = q;
       // Find all documents in this graph that are leaf nodes to speed 
traversal
       DocSet leafNodes = resolveLeafNodes();
+      // Find all documents whose edges may be followed, if restricted by a 
lookup filter
+      DocSet lookupNodes = lookupFilter == null ? null : 
fromSearcher.getDocSet(lookupFilter);

Review Comment:
   šŸ¤– *AI text below* šŸ¤–
   
   Could we skip resolving `lookupFilter` when `maxDepth=0`? The first 
iteration takes the no-edge branch, so this `DocSet` is never used. On a cache 
miss, a root-only query can end up evaluating a filter across the whole index 
even though it never expands anything.



-- 
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]

Reply via email to