Skip to content

armgit / solr

Public Imported from GitHub
0

Apache Solr open-source search software

SOLR-17736: Minor fix for test + documentation

Alessandro Benedetti890444d7a822
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