This is an automated email from the ASF dual-hosted git repository.

mkataria pushed a commit to branch OAK-11636
in repository https://gitbox.apache.org/repos/asf/jackrabbit-oak.git

commit 23f8acde9898753596c95cef40b73764d86b9f7b
Author: Mohit Kataria <[email protected]>
AuthorDate: Thu Apr 17 10:51:27 2025 +0530

    OAK-11636:Implement semantic search in Oak
---
 .../jackrabbit/oak/spi/query/fulltext/InferenceQuery.java      | 10 +++-------
 .../oak/plugins/index/elastic/index/ElasticIndexWriter.java    |  3 +--
 2 files changed, 4 insertions(+), 9 deletions(-)

diff --git 
a/oak-query-spi/src/main/java/org/apache/jackrabbit/oak/spi/query/fulltext/InferenceQuery.java
 
b/oak-query-spi/src/main/java/org/apache/jackrabbit/oak/spi/query/fulltext/InferenceQuery.java
index d5b094365d..b55afef769 100644
--- 
a/oak-query-spi/src/main/java/org/apache/jackrabbit/oak/spi/query/fulltext/InferenceQuery.java
+++ 
b/oak-query-spi/src/main/java/org/apache/jackrabbit/oak/spi/query/fulltext/InferenceQuery.java
@@ -40,8 +40,8 @@ public class InferenceQuery {
         this.queryText = components[1];
     }
 
-    private String[] parseText(String inputtext) {
-        String text = inputtext.trim();
+    private String[] parseText(String inputText) {
+        String text = inputText.trim();
         // Remove the first delimiter
         if (text.startsWith(INFERENCE_QUERY_CONFIG_PREFIX) && 
text.charAt(INFERENCE_QUERY_CONFIG_PREFIX.length()) == '{') {
             text = text.substring(INFERENCE_QUERY_CONFIG_PREFIX.length());
@@ -56,7 +56,6 @@ public class InferenceQuery {
                 possibleEndIndex = text.indexOf(INFERENCE_QUERY_CONFIG_PREFIX, 
possibleEndIndex + 1);
                 if (possibleEndIndex == -1) {
                     // If we reach here, it means we couldn't find a valid 
JSON part
-                    //TODO check if we should use jsonPart as empty or null
                     jsonPart = "";
                     queryTextPart = text;
                     LOG.warn("Query starts with inference prefix {}, but 
without valid json part," +
@@ -74,11 +73,9 @@ public class InferenceQuery {
                     continue;
                 }
             }
-
-//            String queryTextPart = null;
+            // If we found a valid JSON part, extract it
             if (jsonPart == null) {
                 // If we reach here, it means we couldn't find a valid JSON 
part
-                //TODO check if we should use jsonPart as empty or null
                 jsonPart = "";
                 queryTextPart = text;
                 LOG.warn("Query starts with InferenceQueryPrefix: {}, but 
without valid json part," +
@@ -92,7 +89,6 @@ public class InferenceQuery {
             }
             return new String[]{jsonPart, queryTextPart};
         } else {
-            //TODO check if we should use jsonPart as empty or null
             return new String[]{"", text};
         }
     }
diff --git 
a/oak-search-elastic/src/main/java/org/apache/jackrabbit/oak/plugins/index/elastic/index/ElasticIndexWriter.java
 
b/oak-search-elastic/src/main/java/org/apache/jackrabbit/oak/plugins/index/elastic/index/ElasticIndexWriter.java
index 9f77747374..863fd5ecaf 100644
--- 
a/oak-search-elastic/src/main/java/org/apache/jackrabbit/oak/plugins/index/elastic/index/ElasticIndexWriter.java
+++ 
b/oak-search-elastic/src/main/java/org/apache/jackrabbit/oak/plugins/index/elastic/index/ElasticIndexWriter.java
@@ -75,6 +75,7 @@ class ElasticIndexWriter implements 
FulltextIndexWriter<ElasticDocument> {
         this.reindex = reindex;
         this.bulkProcessorHandler = bulkProcessorHandler;
         if (this.reindex) {
+            //TODO Should observe changes under inference config path.
             indexTracker.refreshInferenceConfig().refreshConfig();
         }
         this.inferenceConfig = indexTracker.getInferenceConfig();
@@ -85,8 +86,6 @@ class ElasticIndexWriter implements 
FulltextIndexWriter<ElasticDocument> {
         if (this.reindex) {
             try {
                 // refresh inference config on any index reindex.
-                //TODO We should observe changes under inference config path.
-//                this.inferenceConfig.refreshConfig();
                 long seed = indexDefinition.indexNameSeed == 0L ? 
UUID.randomUUID().getMostSignificantBits() : indexDefinition.indexNameSeed;
                 // merge gets called on node store later in the indexing flow
                 
definitionBuilder.setProperty(ElasticIndexDefinition.PROP_INDEX_NAME_SEED, 
seed);

Reply via email to