Github user dsmiley commented on a diff in the pull request:
https://github.com/apache/lucene-solr/pull/501#discussion_r234498494
--- Diff: solr/core/src/java/org/apache/solr/update/AddUpdateCommand.java
---
@@ -194,20 +203,22 @@ public String getHashableId() {
return null; // caller should call getLuceneDocument() instead
}
- String rootId = getHashableId();
-
- boolean isVersion = version != 0;
-
+ final String rootId = getHashableId();
for (SolrInputDocument sdoc : all) {
- sdoc.setField(IndexSchema.ROOT_FIELD_NAME, rootId);
- if(isVersion) sdoc.setField(CommonParams.VERSION_FIELD, version);
- // TODO: if possible concurrent modification exception (if
SolrInputDocument not cloned and is being forwarded to replicas)
- // then we could add this field to the generated lucene document
instead.
+ addBlockId(sdoc, rootId);
}
return () -> all.stream().map(sdoc -> DocumentBuilder.toDocument(sdoc,
req.getSchema())).iterator();
}
+ private void addBlockId(SolrInputDocument sdoc, String rootId) {
+ boolean isVersion = version != 0;
+ sdoc.setField(IndexSchema.ROOT_FIELD_NAME, rootId);
+ if(isVersion) sdoc.setField(CommonParams.VERSION_FIELD, version);
--- End diff --
although it may be a slight bit of scope creep; I think this logic would be
more clear why it's needed if it merely propagated the SolrInputField from the
root doc to the child docs. My understanding is that this will wind up being
equivalent to what happens now, which is very non-obvious; it took a bunch of
digging on my part to see.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]