@@ -67,6 +67,10 @@ class QdrantDocumentIndex(BaseDocIndex, Generic[TSchema]):
6767
6868 def __init__ (self , db_config = None , ** kwargs ):
6969 """Initialize QdrantDocumentIndex"""
70+ if db_config is not None and getattr (
71+ db_config , 'index_name'
72+ ): # this is needed for subindices
73+ db_config .collection_name = db_config .index_name
7074 super ().__init__ (db_config = db_config , ** kwargs )
7175 self ._db_config : QdrantDocumentIndex .DBConfig = cast (
7276 QdrantDocumentIndex .DBConfig , self ._db_config
@@ -98,11 +102,7 @@ def collection_name(self):
98102 'To do so, use the syntax: QdrantDocumentIndex[DocumentType]'
99103 )
100104
101- return (
102- self ._db_config .collection_name
103- or self ._db_config .index_name
104- or default_collection_name
105- )
105+ return self ._db_config .collection_name or default_collection_name
106106
107107 @property
108108 def index_name (self ):
@@ -250,6 +250,12 @@ class DBConfig(BaseDocIndex.DBConfig):
250250 }
251251 )
252252
253+ def __post_init__ (self ):
254+ if self .collection_name is None and self .index_name is not None :
255+ self .collection_name = self .index_name
256+ if self .index_name is None and self .collection_name is not None :
257+ self .index_name = self .collection_name
258+
253259 @dataclass
254260 class RuntimeConfig (BaseDocIndex .RuntimeConfig ):
255261 """Dataclass that contains all "dynamic" configurations of QdrantDocumentIndex."""
0 commit comments