Copilot commented on code in PR #3564:
URL: https://github.com/apache/tika/pull/3564#discussion_r4525711673


##########
tika-parsers/tika-parsers-standard/tika-parsers-standard-modules/tika-parser-microsoft-module/src/main/java/org/apache/tika/parser/microsoft/onenote/OneNoteDocument.java:
##########
@@ -50,6 +59,26 @@ void setAssocGuidToRef(ExtendedGUID guid, FileChunkReference 
ref) {
         guidToRef.put(guid, ref);
     }
 
+    void putObject(ExtendedGUID oid, FileNodePtr ptr) {
+        guidToObject.put(oid, ptr);
+        revisionObjects.computeIfAbsent(currentRevision, k -> new 
HashMap<>()).put(oid, ptr);
+    }
+
+    /** The object as revision {@code rid} has it: declared there or in a 
dependency. */
+    FileNodePtr objectIn(ExtendedGUID rid, ExtendedGUID oid) {
+        ExtendedGUID r = rid;
+        for (int i = 0; r != null && i <= revisionMap.size(); i++) {
+            Map<ExtendedGUID, FileNodePtr> objects = revisionObjects.get(r);
+            FileNodePtr ptr = objects == null ? null : objects.get(oid);

Review Comment:
   Each object lookup restarts the dependency walk, so resolving M unchanged 
objects declared near the base of an R-revision chain takes O(M × R) map 
lookups. Extraction can become quadratic as both content and revision history 
grow, and the file-node visit budget does not count these scans. Build a 
cycle-safe effective-object index for the selected revision, or cache inherited 
resolutions along the dependency chain.



##########
tika-parsers/tika-parsers-standard/tika-parsers-standard-modules/tika-parser-microsoft-module/src/main/java/org/apache/tika/parser/microsoft/onenote/OneNoteParserConfig.java:
##########
@@ -0,0 +1,56 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tika.parser.microsoft.onenote;
+
+import java.io.Serializable;
+
+/**
+ * Configuration for {@link OneNoteParser}, set in the parser's JSON config or 
per parse in the
+ * {@link org.apache.tika.parser.ParseContext}.
+ */
+public class OneNoteParserConfig implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    private boolean includePageHistory = false;
+    private boolean includeDeletedContent = false;
+
+    /**
+     * Whether text includes every earlier revision and saved page version, 
not only each page's
+     * current one.
+     */
+    public boolean isIncludePageHistory() {
+        return includePageHistory;
+    }
+
+    public void setIncludePageHistory(boolean includePageHistory) {
+        this.includePageHistory = includePageHistory;

Review Comment:
   With `includePageHistory=true`, `OneNoteParser` enables 
`crawlAllFileNodesFromRoot` but leaves `onlyLatestRevision=true`, so the 
classic walker's history filter still suppresses marked saved-page versions. 
Set `onlyLatestRevision` to `!config.isIncludePageHistory()` when constructing 
the walker options, and add a regression case for text beneath 
`VersionHistoryGraphSpaceContextNodes` or `VERSION_HISTORY_CONTENT`.



-- 
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]

Reply via email to