Github user dsmiley commented on a diff in the pull request:
https://github.com/apache/lucene-solr/pull/501#discussion_r234496324
--- 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) {
--- End diff --
Can we rename this addRootField? and separate out the version part to
addVersionField which should _not_ be called by this method; the caller should.
addVersionField only needs to be called for the nested case, not by
getLuceneDocument.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]