Github user dsmiley commented on a diff in the pull request:
https://github.com/apache/lucene-solr/pull/455#discussion_r231127727
--- Diff:
solr/core/src/java/org/apache/solr/handler/component/RealTimeGetComponent.java
---
@@ -639,12 +651,32 @@ public static SolrInputDocument
getInputDocument(SolrCore core, BytesRef idBytes
sid = new SolrInputDocument();
} else {
Document luceneDocument = docFetcher.doc(docid);
- sid = toSolrInputDocument(luceneDocument,
core.getLatestSchema());
+ sid = toSolrInputDocument(luceneDocument, schema);
}
- if (onlyTheseNonStoredDVs != null) {
- docFetcher.decorateDocValueFields(sid, docid,
onlyTheseNonStoredDVs);
- } else {
- docFetcher.decorateDocValueFields(sid, docid,
docFetcher.getNonStoredDVsWithoutCopyTargets());
+ ensureDocFieldsDecorated(onlyTheseNonStoredDVs, sid, docid,
docFetcher, resolveRootDoc ||
+ resolveChildren ||
schema.hasExplicitField(IndexSchema.NEST_PATH_FIELD_NAME));
+ SolrInputField rootField =
sid.getField(IndexSchema.ROOT_FIELD_NAME);
+ if((resolveChildren || resolveRootDoc) &&
schema.isUsableForChildDocs() && rootField!=null) {
+ // doc is part of a nested structure
+ String id = resolveRootDoc? (String) rootField.getFirstValue():
(String) sid.getField(idField.getName()).getFirstValue();
+ ModifiableSolrParams params = new ModifiableSolrParams()
+ .set("fl", "*, _nest_path_, [child]")
+ .set("limit", "-1");
+ SolrQueryRequest nestedReq = new LocalSolrQueryRequest(core,
params);
+ final BytesRef rootIdBytes = new BytesRef(id);
+ final int rootDocId = searcher.getFirstMatch(new
Term(idField.getName(), rootIdBytes));
+ final DocTransformer childDocTransformer =
TransformerFactory.defaultFactories.get("child").create("child", params,
nestedReq);
--- End diff --
no, use `core.getTransformerFactory("child")`
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]