From 5629fbd2ca60708a8c6a04e7996423158cedae17 Mon Sep 17 00:00:00 2001 From: Billy Bao Date: Fri, 7 Nov 2025 09:28:42 +0800 Subject: [PATCH] Fix: OpenSearch retrieval no return & Add documentation of /retrieval (#11083) ### What problem does this PR solve? Fix: OpenSearch retrieval no return #11006 Add documentation #11072 ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue) - [x] Documentation Update --------- Co-authored-by: Kevin Hu Co-authored-by: writinwaters <93570324+writinwaters@users.noreply.github.com> --- docs/references/http_api_reference.md | 4 +++- rag/nlp/search.py | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/docs/references/http_api_reference.md b/docs/references/http_api_reference.md index 7af9d4bdf..f2b86a735 100644 --- a/docs/references/http_api_reference.md +++ b/docs/references/http_api_reference.md @@ -1840,7 +1840,7 @@ Retrieves chunks from specified datasets. - `"highlight"`: `boolean` - `"cross_languages"`: `list[string]` - `"metadata_condition"`: `object` - + - `"use_kg"`: `boolean` ##### Request example ```bash @@ -1888,6 +1888,8 @@ curl --request POST \ The weight of vector cosine similarity. Defaults to `0.3`. If x represents the weight of vector cosine similarity, then (1 - x) is the term similarity weight. - `"top_k"`: (*Body parameter*), `integer` The number of chunks engaged in vector cosine computation. Defaults to `1024`. +- `"use_kg"`: (*Body parameter*), `boolean` + The search includes text chunks related to the knowledge graph of the selected dataset to handle complex multi-hop queries. Defaults to `False`. - `"rerank_id"`: (*Body parameter*), `integer` The ID of the rerank model. - `"keyword"`: (*Body parameter*), `boolean` diff --git a/rag/nlp/search.py b/rag/nlp/search.py index 09c1324d3..1bf0abe04 100644 --- a/rag/nlp/search.py +++ b/rag/nlp/search.py @@ -384,7 +384,7 @@ class Dealer: rank_feature=rank_feature) else: lower_case_doc_engine = os.getenv('DOC_ENGINE', 'elasticsearch') - if lower_case_doc_engine == "elasticsearch": + if lower_case_doc_engine in ["elasticsearch","opensearch"]: # ElasticSearch doesn't normalize each way score before fusion. sim, tsim, vsim = self.rerank( sres, question, 1 - vector_similarity_weight, vector_similarity_weight,