This is an automated email from the ASF dual-hosted git repository.

abenedetti pushed a commit to branch branch_10x
in repository https://gitbox.apache.org/repos/asf/solr.git


The following commit(s) were added to refs/heads/branch_10x by this push:
     new 9cbcb73d9e6 SOLR-17736: Minor fix for test + documentation
9cbcb73d9e6 is described below

commit 9cbcb73d9e6dfe678eb6c0b36c6aac46a48b4d53
Author: Alessandro Benedetti <[email protected]>
AuthorDate: Fri Dec 19 12:34:59 2025 +0100

    SOLR-17736: Minor fix for test + documentation
    
    (cherry picked from commit 890444d7a822cf55e05e04c05ed698b67a946b7c)
---
 .../org/apache/solr/search/vector/KnnQParser.java  |  2 +-
 .../query-guide/pages/dense-vector-search.adoc     | 36 ++++++++++++----------
 2 files changed, 21 insertions(+), 17 deletions(-)

diff --git a/solr/core/src/java/org/apache/solr/search/vector/KnnQParser.java 
b/solr/core/src/java/org/apache/solr/search/vector/KnnQParser.java
index ee82d78909c..95ff94ea372 100644
--- a/solr/core/src/java/org/apache/solr/search/vector/KnnQParser.java
+++ b/solr/core/src/java/org/apache/solr/search/vector/KnnQParser.java
@@ -141,7 +141,7 @@ public class KnnQParser extends AbstractVectorQParserBase {
       if (null == allParentsQuery) {
         throw new SolrException(
             SolrException.ErrorCode.BAD_REQUEST,
-            "When running a diversifying children KNN query, 'allParents' 
parameter is required");
+            "When running a diversifying children KNN query, 'childrenOf' 
parameter is required");
       }
       final DenseVectorParser vectorBuilder =
           denseVectorType.getVectorBuilder(vectorToSearch, 
DenseVectorParser.BuilderPhase.QUERY);
diff --git 
a/solr/solr-ref-guide/modules/query-guide/pages/dense-vector-search.adoc 
b/solr/solr-ref-guide/modules/query-guide/pages/dense-vector-search.adoc
index 7f9122fe8fa..777b250522b 100644
--- a/solr/solr-ref-guide/modules/query-guide/pages/dense-vector-search.adoc
+++ b/solr/solr-ref-guide/modules/query-guide/pages/dense-vector-search.adoc
@@ -516,45 +516,49 @@ Here is an example of a `knn` search using a 
`filteredSearchThreshold`:
 [source,text]
 ?q={!knn f=vector topK=10 filteredSearchThreshold=60}[1.0, 2.0, 3.0, 4.0]
 
-`parents.preFilter`::
+`childrenOf`::
 +
 [%autowidth,frame=none]
 |===
 |Optional |Default: none
+|Mandatory if using 'parents.preFilter' parameter|Default: none
 |===
-This parameter is meant to be a filter query on parent document metadata.
-The knn search returns the top-k nearest children documents that satify the 
filter on the parent.
 +
-Only one child per distinct parent is returned.
+A query that matches the set of ALL possible parent documents.
++
+This parameter is required to enable documents diversification per parent (to 
return maximum one document per parent).
++
+If you use it you can also add the 'parents.preFilter' parameter.
 
-Here is an example of a `knn` search using a `parents.preFilter`:
+Here is an example of a `knn` search using a `childrenOf`:
 
 [source,text]
-?q={!knn f=vector topK=3 parents.preFilter=$someParents 
childrenOf=$allParents}[1.0, 2.0, 3.0, 4.0]
+?q={!knn f=vector topK=3 childrenOf=$allParents}[1.0, 2.0, 3.0, 4.0]
 &allParents=*:* -_nest_path_:*
-&someParents=color_s:RED
 
-The search results retrieved are the k=3 nearest documents to the vector in 
input `[1.0, 2.0, 3.0, 4.0]`, each of them with a different parent. Only the 
documents with a parent that satisfy the 'color_s:RED' condition are considered 
candidates for the ANN search.
+The search results retrieved are the k=3 nearest documents to the vector in 
input `[1.0, 2.0, 3.0, 4.0]`, each of them with a different parent. The 
'childrenOf' parameter must return all valid parents to guarantee the correct 
functioning of the query.
 
-`childrenOf`::
+`parents.preFilter`::
 +
 [%autowidth,frame=none]
 |===
 |Optional |Default: none
-|Mandatory if using 'parents.preFilter' parameter|Default: none
 |===
+This parameter is meant to be a filter query on parent document metadata.
+The knn search returns the top-k nearest children documents that satisfy the 
filter on the parent.
 +
-A query that matches the set of ALL possible parent documents.
-It's required to work with the 'parents.preFilter' parameter.
-
+Only one child per distinct parent is returned.
++
+When using it, you need to also specify the `childrenOf` param.
 
-Here is an example of a `knn` search using a `childrenOf`:
+Here is an example of a `knn` search using a `parents.preFilter`:
 
 [source,text]
-?q={!knn f=vector topK=3 childrenOf=$allParents}[1.0, 2.0, 3.0, 4.0]
+?q={!knn f=vector topK=3 parents.preFilter=$someParents 
childrenOf=$allParents}[1.0, 2.0, 3.0, 4.0]
 &allParents=*:* -_nest_path_:*
+&someParents=color_s:RED
 
-The search results retrieved are the k=3 nearest documents to the vector in 
input `[1.0, 2.0, 3.0, 4.0]`, each of them with a different parent. The 
'childrenOf' parameter must return all valid parents to guarantee the correct 
functioning of the query.
+The search results retrieved are the k=3 nearest documents to the vector in 
input `[1.0, 2.0, 3.0, 4.0]`, each of them with a different parent. Only the 
documents with a parent that satisfy the 'color_s:RED' condition are considered 
candidates for the ANN search.
 
 === knn_text_to_vector Query Parser
 

Reply via email to