From 24624491cd963cea37a6063b696dd23126de3b99 Mon Sep 17 00:00:00 2001 From: Jyong <76649700+JohnJyong@users.noreply.github.com> Date: Thu, 23 May 2024 18:11:01 +0800 Subject: [PATCH] add qdrant metadata.doc_id index when create qdrant collection (#4570) --- api/core/rag/datasource/vdb/field.py | 1 + api/core/rag/datasource/vdb/qdrant/qdrant_vector.py | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/api/core/rag/datasource/vdb/field.py b/api/core/rag/datasource/vdb/field.py index dc400dafbb..1c16e4d9cd 100644 --- a/api/core/rag/datasource/vdb/field.py +++ b/api/core/rag/datasource/vdb/field.py @@ -8,3 +8,4 @@ class Field(Enum): VECTOR = "vector" TEXT_KEY = "text" PRIMARY_KEY = "id" + DOC_ID = "metadata.doc_id" diff --git a/api/core/rag/datasource/vdb/qdrant/qdrant_vector.py b/api/core/rag/datasource/vdb/qdrant/qdrant_vector.py index e6e83c66d8..7a92314542 100644 --- a/api/core/rag/datasource/vdb/qdrant/qdrant_vector.py +++ b/api/core/rag/datasource/vdb/qdrant/qdrant_vector.py @@ -115,9 +115,12 @@ class QdrantVector(BaseVector): timeout=int(self._client_config.timeout), ) - # create payload index + # create group_id payload index self._client.create_payload_index(collection_name, Field.GROUP_KEY.value, field_schema=PayloadSchemaType.KEYWORD) + # create doc_id payload index + self._client.create_payload_index(collection_name, Field.DOC_ID.value, + field_schema=PayloadSchemaType.KEYWORD) # creat full text index text_index_params = TextIndexParams( type=TextIndexType.TEXT,