ChlineSaurus commented on code in PR #3078:
URL: https://github.com/apache/jackrabbit-oak/pull/3078#discussion_r3801458594
##########
oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/inventory/IndexDefinitionPrinter.java:
##########
@@ -81,4 +97,44 @@ public void setFilter(String filter) {
private JsonSerializer createSerializer(JsopBuilder json) {
return new JsonSerializer(json, filter, new Base64BlobSerializer());
}
+
+ /**
+ * Serialize a diff index node, inlining its {@code diff.json} payload as
JSON. All other file child nodes are
+ * rendered as base64 blobs, for backward compatibility.
+ */
+ private void serializeDiffIndex(JsopBuilder json, NodeState idxState) {
+ json.object();
+ JsonSerializer serializer = createSerializer(json);
+ // definition properties (mirror the default filter, which drops
:childOrder)
+ for (PropertyState p : idxState.getProperties()) {
+ if (":childOrder".equals(p.getName())) {
+ continue;
+ }
+ json.key(p.getName());
+ serializer.serialize(p);
+ }
+ // non-hidden child nodes other than diff.json, rendered normally
+ for (ChildNodeEntry child : idxState.getChildNodeEntries()) {
Review Comment:
Is this running with the right order of child nodes? Or does it even matter
here?
(I struggle a bit to understand where OAK requires correct node ordering and
where not)
##########
oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/inventory/IndexDefinitionPrinter.java:
##########
@@ -69,6 +74,17 @@ public void print(PrintWriter printWriter, Format format,
boolean isZip) {
NodeState idxState = NodeStateUtils.getNode(root, indexPath);
createSerializer(json).serialize(idxState);
}
+ // The "diff" indexes (diff.index / diff.index.optimizer) are not
oak:QueryIndexDefinition nodes, so they
Review Comment:
Detail (what confused Claude): In
oak-doc/src/site/markdown/query/indexing.md we write:
The diff index consists of:
/oak:index/diff.index
- type: disabled
- jcr:primaryType: oak:QueryIndexDefinition
+ diff.json (nt:file)
This contradicts the jcr:primaryType actually used and recommended in the
customer facing doc, but if following the oak doc the primary type is
oak:QueryIndexDefinition and therefore picked up in the index printer.
##########
oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/inventory/IndexDefinitionPrinter.java:
##########
@@ -69,6 +74,17 @@ public void print(PrintWriter printWriter, Format format,
boolean isZip) {
NodeState idxState = NodeStateUtils.getNode(root, indexPath);
createSerializer(json).serialize(idxState);
}
+ // The "diff" indexes (diff.index / diff.index.optimizer) are not
oak:QueryIndexDefinition nodes, so they
Review Comment:
But if one uses _jcr:primaryType: oak:QueryIndexDefinition_, we now end up
with a duplicate key _/oak:index/diff.index_, so probably worth changing the
doc.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]