nit0906 commented on code in PR #2234: URL: https://github.com/apache/jackrabbit-oak/pull/2234#discussion_r2055332063
########## oak-search-elastic/src/main/java/org/apache/jackrabbit/oak/plugins/index/elastic/query/ElasticRequestHandler.java: ########## @@ -569,11 +575,37 @@ private boolean visitTerm(String propertyName, String text, String boost, boolea boolean includeDynamicBoostedValues = !elasticIndexDefinition.getDynamicBoostProperties().isEmpty() && elasticIndexDefinition.getDynamicBoostProperties().stream().anyMatch(ElasticPropertyDefinition::useInFullTextQuery); + String indexName = PathUtils.getName(indexPlan.getPlanName()); + String inferenceModelConfig = ""; + InferenceQueryConfig inferenceQueryConfig; + InferenceQuery inferenceQuery; + if (text.startsWith(InferenceQuery.INFERENCE_QUERY_CONFIG_PREFIX)) { + inferenceQuery = new InferenceQuery(text); + String queryConfig = inferenceQuery.getQueryInferenceConfig(); + queryText = inferenceQuery.getQueryText(); + inferenceQueryConfig = new InferenceQueryConfig(queryConfig); + inferenceModelConfig = inferenceQueryConfig.getInferenceModelConfig().isBlank() + ? InferenceConfig.getInstance().getInferenceIndexConfig(indexName).getDefaultEnabledModel().getInferenceModelConfigName() + : InferenceConfig.getInstance().getInferenceModelConfig(indexName, inferenceQueryConfig.getInferenceModelConfig()).getInferenceModelConfigName(); + } else { + inferenceQueryConfig = null; + inferenceQuery = null; + queryText = text; + } + + if (InferenceConfig.getInstance().isEnabled() + && !InferenceModelConfig.NOOP.equals(InferenceConfig.getInstance().getInferenceModelConfig(indexName, inferenceModelConfig))) { + + bqBuilder.must(m -> m.bool(b -> inferenceConfigQuery(b, propertyName, queryText, pr, includeDynamicBoostedValues, inferenceQuery, inferenceQueryConfig))); + } // Experimental support for inference queries - if (elasticIndexDefinition.inferenceDefinition != null && elasticIndexDefinition.inferenceDefinition.queries != null) { - bqBuilder.must(m -> m.bool(b -> inference(b, propertyName, text, pr, includeDynamicBoostedValues))); + else if (elasticIndexDefinition.inferenceDefinition != null && elasticIndexDefinition.inferenceDefinition.queries != null) { Review Comment: Is this for backward compat with the PoC. ? -- 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: oak-dev-unsubscr...@jackrabbit.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org