Github user dsmiley commented on a diff in the pull request:
https://github.com/apache/lucene-solr/pull/416#discussion_r205121128
--- Diff:
solr/core/src/java/org/apache/solr/response/transform/DeeplyNestedChildDocTransformer.java
---
@@ -132,54 +126,49 @@ public void transform(SolrDocument rootDoc, int
rootDocId) {
// load the doc
SolrDocument doc =
DocsStreamer.convertLuceneDocToSolrDoc(docFetcher.doc(docId),
schema, new SolrReturnFields());
- doc.setField(NEST_PATH_FIELD_NAME, fullDocPath);
if (shouldDecorateWithDVs) {
docFetcher.decorateDocValueFields(doc, docId,
dvFieldsToReturn);
}
// get parent path
// put into pending
String parentDocPath = lookupParentPath(fullDocPath);
- pendingParentPathsToChildren.put(parentDocPath, doc); //
multimap add (won't replace)
- // if this path has pending child docs, add them.
- if (isAncestor) {
- addChildrenToParent(doc,
pendingParentPathsToChildren.get(fullDocPath));
- pendingParentPathsToChildren.removeAll(fullDocPath); // no
longer pending
+ if(isAncestor) {
+ // if this path has pending child docs, add them.
+ addChildrenToParent(doc,
pendingParentPathsToChildren.remove(fullDocPath)); // no longer pending
}
+ pendingParentPathsToChildren.computeIfAbsent(parentDocPath, x
-> ArrayListMultimap.create())
+ .put(trimIfSingleDoc(getLastPath(fullDocPath)), doc); //
multimap add (won't replace)
--- End diff --
I believe we simply want the label here; maybe add a method getLeafLabel()
that takes a path and returns the leaf label. It would trim off any "#" with
digits no matter if it's a single doc or not.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]