瀏覽代碼

add qdrant metadata.doc_id index when create qdrant collection (#4570)

Jyong 11 月之前
父節點
當前提交
24624491cd
共有 2 個文件被更改,包括 5 次插入1 次删除
  1. 1 0
      api/core/rag/datasource/vdb/field.py
  2. 4 1
      api/core/rag/datasource/vdb/qdrant/qdrant_vector.py

+ 1 - 0
api/core/rag/datasource/vdb/field.py

@@ -8,3 +8,4 @@ class Field(Enum):
     VECTOR = "vector"
     VECTOR = "vector"
     TEXT_KEY = "text"
     TEXT_KEY = "text"
     PRIMARY_KEY = "id"
     PRIMARY_KEY = "id"
+    DOC_ID = "metadata.doc_id"

+ 4 - 1
api/core/rag/datasource/vdb/qdrant/qdrant_vector.py

@@ -115,9 +115,12 @@ class QdrantVector(BaseVector):
                     timeout=int(self._client_config.timeout),
                     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,
                 self._client.create_payload_index(collection_name, Field.GROUP_KEY.value,
                                                   field_schema=PayloadSchemaType.KEYWORD)
                                                   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
                 # creat full text index
                 text_index_params = TextIndexParams(
                 text_index_params = TextIndexParams(
                     type=TextIndexType.TEXT,
                     type=TextIndexType.TEXT,