Apache Solr open-source search software
SOLR-15427: Nested docs: [child limit=...] now defaults to -1 (#144)
David Smiley0cb23c7c2805
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txtindex 1a16b5d78bf..27c3db83bf6 100644--- a/solr/CHANGES.txt+++ b/solr/CHANGES.txt@@ -176,6 +176,9 @@ when told to. The admin UI now tells it to. (Nazerke Seidan, David Smiley)* SOLR-15376: Accept "Long" values for CollectionAdminRequest.CreateTimeRoutedAlias.setMaxFutureMsto support durations greater than ~ 25 days. (Nahian-Al Hasan, Gus Heck, Christine Poerschke)+* SOLR-15427: Nested docs: [child limit=...] now defaults to -1 which is interpreted as unlimited.+ (David Smiley)+Build---------------------@@ -437,7 +440,7 @@ Bug Fixes* SOLR-15635: Don't close hooks twice when SolrRequestInfo is cleared twice; or /export with classic joinclosed fromCore if provided (Mikhail Khludnev, David Smiley)-+* SOLR-15795: Fix REPLACENODE to not use source node when choosing a target node for new replicas (Houston Putman)* SOLR-15804: Admin UI once again can show files in the Core/Collection -> Files screen. Fixed regression from 8.11.0 (Karl Stoney, janhoy)diff --git a/solr/core/src/java/org/apache/solr/response/transform/ChildDocTransformerFactory.java b/solr/core/src/java/org/apache/solr/response/transform/ChildDocTransformerFactory.javaindex 95902e276e7..54ba1d4dd3b 100644--- a/solr/core/src/java/org/apache/solr/response/transform/ChildDocTransformerFactory.java+++ b/solr/core/src/java/org/apache/solr/response/transform/ChildDocTransformerFactory.java@@ -16,6 +16,8 @@*/package org.apache.solr.response.transform;+import static org.apache.solr.schema.IndexSchema.NEST_PATH_FIELD_NAME;+import java.io.IOException;import java.io.UncheckedIOException;@@ -38,8 +40,6 @@ import org.apache.solr.search.SolrCache;import org.apache.solr.search.SolrReturnFields;import org.apache.solr.search.SyntaxError;-import static org.apache.solr.schema.IndexSchema.NEST_PATH_FIELD_NAME;-/*** Attaches all descendants (child documents) to each parent document.*@@ -49,7 +49,7 @@ import static org.apache.solr.schema.IndexSchema.NEST_PATH_FIELD_NAME;** Optionally you can provide a "childFilter" param to filter out which child documents should be returned and a* "limit" param which provides an option to specify the number of child documents- * to be returned per parent document. By default it's set to 10.+ * to be returned per parent document.** Examples -* [child parentFilter="fieldName:fieldValue"]@@ -95,11 +95,6 @@ public class ChildDocTransformerFactory extends TransformerFactory {String parentFilterStr = params.get( "parentFilter" );BitSetProducer parentsFilter;- // TODO reuse org.apache.solr.search.join.BlockJoinParentQParser.getCachedFilter (uses a cache)- // TODO shouldn't we try to use the Solr filter cache, and then ideally implement- // BitSetProducer over that?- // DocSet parentDocSet = req.getSearcher().getDocSet(parentFilterQuery);- // then return BitSetProducer with custom BitSet impl accessing the docSetif (parentFilterStr == null) {parentsFilter = !buildHierarchy ? null : getCachedBitSetProducer(req, rootFilter);} else {@@ -137,7 +132,10 @@ public class ChildDocTransformerFactory extends TransformerFactory {childSolrReturnFields = new SolrReturnFields(req);}- int limit = params.getInt( "limit", 10 );+ int limit = params.getInt("limit", -1);+ if (limit == -1) {+ limit = Integer.MAX_VALUE;+ }return new ChildDocTransformer(field, parentsFilter, childDocSet, childSolrReturnFields,buildHierarchy, limit, req.getSchema().getUniqueKeyField().getName());@@ -175,7 +173,11 @@ public class ChildDocTransformerFactory extends TransformerFactory {+ " +(" + remaining + ")";}- public static BitSetProducer getCachedBitSetProducer(final SolrQueryRequest request, Query query) {+ private static BitSetProducer getCachedBitSetProducer(final SolrQueryRequest request, Query query) {+ // TODO shouldn't we try to use the Solr filter cache, and then ideally implement+ // BitSetProducer over that?+ // DocSet parentDocSet = req.getSearcher().getDocSet(parentFilterQuery);+ // then return BitSetProducer with custom BitSet impl accessing the docSet@SuppressWarnings("unchecked")SolrCache<Query, BitSetProducer> parentCache = request.getSearcher().getCache(CACHE_NAME);// lazily retrieve from solr cachediff --git a/solr/solr-ref-guide/src/document-transformers.adoc b/solr/solr-ref-guide/src/document-transformers.adocindex b53185f8298..8aa005dfb75 100644--- a/solr/solr-ref-guide/src/document-transformers.adoc+++ b/solr/solr-ref-guide/src/document-transformers.adoc@@ -153,10 +153,10 @@ This can be particularly useful when you have multiple levels of hierarchical do+[%autowidth,frame=none]|===-|Optional |Default: `10`+|Optional |Default: `-1`|===+-The maximum number of child documents to be returned per parent document.+The maximum number of child documents to be returned underneath the document being augmented. The default is `-1` which means unlimited.`fl`::+