From 42935997aa843b6c6b5a3859fa916178f4e8be07 Mon Sep 17 00:00:00 2001 From: twwu Date: Thu, 21 Aug 2025 16:29:23 +0800 Subject: [PATCH] refactor(retrieval-method): update retrieval method from invertedIndex to keywordSearch across components --- .../common/economical-retrieval-method-config/index.tsx | 4 ++-- .../datasets/common/retrieval-param-config/index.tsx | 3 +-- web/app/components/datasets/hit-testing/textarea.tsx | 2 +- .../knowledge-base/components/retrieval-setting/hooks.tsx | 2 +- .../components/retrieval-setting/search-method-option.tsx | 2 +- .../workflow/nodes/knowledge-base/hooks/use-config.ts | 4 ++-- .../nodes/knowledge-base/hooks/use-settings-display.ts | 2 +- 7 files changed, 9 insertions(+), 10 deletions(-) diff --git a/web/app/components/datasets/common/economical-retrieval-method-config/index.tsx b/web/app/components/datasets/common/economical-retrieval-method-config/index.tsx index 024ba075b6..59a493497e 100644 --- a/web/app/components/datasets/common/economical-retrieval-method-config/index.tsx +++ b/web/app/components/datasets/common/economical-retrieval-method-config/index.tsx @@ -24,7 +24,7 @@ const EconomicalRetrievalMethodConfig: FC = ({ return ( } iconActiveColor='text-util-colors-purple-purple-600' @@ -37,7 +37,7 @@ const EconomicalRetrievalMethodConfig: FC = ({ className='gap-x-2' > diff --git a/web/app/components/datasets/common/retrieval-param-config/index.tsx b/web/app/components/datasets/common/retrieval-param-config/index.tsx index 2ad5317faa..216a56ab16 100644 --- a/web/app/components/datasets/common/retrieval-param-config/index.tsx +++ b/web/app/components/datasets/common/retrieval-param-config/index.tsx @@ -38,7 +38,7 @@ const RetrievalParamConfig: FC = ({ }) => { const { t } = useTranslation() const canToggleRerankModalEnable = type !== RETRIEVE_METHOD.hybrid - const isEconomical = type === RETRIEVE_METHOD.invertedIndex + const isEconomical = type === RETRIEVE_METHOD.keywordSearch const isHybridSearch = type === RETRIEVE_METHOD.hybrid const { modelList: rerankModelList, @@ -61,7 +61,6 @@ const RetrievalParamConfig: FC = ({ ...value, reranking_enable: enable, }) - // eslint-disable-next-line react-hooks/exhaustive-deps }, [currentModel, onChange, value]) const rerankModel = useMemo(() => { diff --git a/web/app/components/datasets/hit-testing/textarea.tsx b/web/app/components/datasets/hit-testing/textarea.tsx index c92e107542..59585fc0fc 100644 --- a/web/app/components/datasets/hit-testing/textarea.tsx +++ b/web/app/components/datasets/hit-testing/textarea.tsx @@ -103,7 +103,7 @@ const TextAreaWithButton = ({ setLoading(false) } - const retrievalMethod = isEconomy ? RETRIEVE_METHOD.invertedIndex : retrievalConfig.search_method + const retrievalMethod = isEconomy ? RETRIEVE_METHOD.keywordSearch : retrievalConfig.search_method const icon = return ( <> diff --git a/web/app/components/workflow/nodes/knowledge-base/components/retrieval-setting/hooks.tsx b/web/app/components/workflow/nodes/knowledge-base/components/retrieval-setting/hooks.tsx index 9d39f81182..4b16c7d0e8 100644 --- a/web/app/components/workflow/nodes/knowledge-base/components/retrieval-setting/hooks.tsx +++ b/web/app/components/workflow/nodes/knowledge-base/components/retrieval-setting/hooks.tsx @@ -46,7 +46,7 @@ export const useRetrievalSetting = (indexMethod?: IndexMethodEnum) => { }, [t]) const InvertedIndexOption: Option = useMemo(() => { return { - id: RetrievalSearchMethodEnum.invertedIndex, + id: RetrievalSearchMethodEnum.keywordSearch, icon: HybridSearch as any, title: t('dataset.retrieval.invertedIndex.title'), description: t('dataset.retrieval.invertedIndex.description'), diff --git a/web/app/components/workflow/nodes/knowledge-base/components/retrieval-setting/search-method-option.tsx b/web/app/components/workflow/nodes/knowledge-base/components/retrieval-setting/search-method-option.tsx index 28389ca41e..74629f47ae 100644 --- a/web/app/components/workflow/nodes/knowledge-base/components/retrieval-setting/search-method-option.tsx +++ b/web/app/components/workflow/nodes/knowledge-base/components/retrieval-setting/search-method-option.tsx @@ -194,7 +194,7 @@ const SearchMethodOption = ({ isScoreThresholdEnabled={isScoreThresholdEnabled} onScoreThresholdEnabledChange={onScoreThresholdEnabledChange} readonly={readonly} - hiddenScoreThreshold={searchMethod === RetrievalSearchMethodEnum.invertedIndex} + hiddenScoreThreshold={searchMethod === RetrievalSearchMethodEnum.keywordSearch} /> diff --git a/web/app/components/workflow/nodes/knowledge-base/hooks/use-config.ts b/web/app/components/workflow/nodes/knowledge-base/hooks/use-config.ts index fb8791413c..215ef85559 100644 --- a/web/app/components/workflow/nodes/knowledge-base/hooks/use-config.ts +++ b/web/app/components/workflow/nodes/knowledge-base/hooks/use-config.ts @@ -49,7 +49,7 @@ export const useConfig = (id: string) => { indexing_technique: (chunkStructure === ChunkStructureEnum.parent_child || chunkStructure === ChunkStructureEnum.question_answer) ? IndexMethodEnum.QUALIFIED : indexing_technique, retrieval_model: { ...retrieval_model, - search_method: ((chunkStructure === ChunkStructureEnum.parent_child || chunkStructure === ChunkStructureEnum.question_answer) && !isHighQualitySearchMethod(search_method)) ? RetrievalSearchMethodEnum.semantic : search_method, + search_method: ((chunkStructure === ChunkStructureEnum.parent_child || chunkStructure === ChunkStructureEnum.question_answer) && !isHighQualitySearchMethod(search_method)) ? RetrievalSearchMethodEnum.keywordSearch : search_method, }, index_chunk_variable_selector: chunkStructure === chunk_structure ? index_chunk_variable_selector : [], }) @@ -62,7 +62,7 @@ export const useConfig = (id: string) => { draft.indexing_technique = indexMethod if (indexMethod === IndexMethodEnum.ECONOMICAL) - draft.retrieval_model.search_method = RetrievalSearchMethodEnum.invertedIndex + draft.retrieval_model.search_method = RetrievalSearchMethodEnum.keywordSearch else if (indexMethod === IndexMethodEnum.QUALIFIED) draft.retrieval_model.search_method = RetrievalSearchMethodEnum.semantic })) diff --git a/web/app/components/workflow/nodes/knowledge-base/hooks/use-settings-display.ts b/web/app/components/workflow/nodes/knowledge-base/hooks/use-settings-display.ts index 64679642ab..b4f0b50c0c 100644 --- a/web/app/components/workflow/nodes/knowledge-base/hooks/use-settings-display.ts +++ b/web/app/components/workflow/nodes/knowledge-base/hooks/use-settings-display.ts @@ -13,6 +13,6 @@ export const useSettingsDisplay = () => { [RetrievalSearchMethodEnum.semantic]: t('dataset.retrieval.semantic_search.title'), [RetrievalSearchMethodEnum.fullText]: t('dataset.retrieval.full_text_search.title'), [RetrievalSearchMethodEnum.hybrid]: t('dataset.retrieval.hybrid_search.title'), - [RetrievalSearchMethodEnum.invertedIndex]: t('dataset.retrieval.invertedIndex.title'), + [RetrievalSearchMethodEnum.keywordSearch]: t('dataset.retrieval.invertedIndex.title'), } }