@@ -133,6 +133,12 @@ async def query_vector(
133133 if filters is not None :
134134 raise NotImplementedError ("Qdrant provider does not yet support native filtering" )
135135
136+ # Collections are created lazily on first insert, so a search against a
137+ # store that has never had chunks added has no collection yet. Treat that
138+ # as an empty result rather than letting Qdrant raise a 404.
139+ if not await self .client .collection_exists (self .collection_name ):
140+ return QueryChunksResponse (chunks = [], scores = [])
141+
136142 results = (
137143 await self .client .query_points (
138144 collection_name = self .collection_name ,
@@ -184,6 +190,12 @@ async def query_keyword(
184190 if filters is not None :
185191 raise NotImplementedError ("Qdrant provider does not yet support native filtering" )
186192
193+ # Collections are created lazily on first insert, so a search against a
194+ # store that has never had chunks added has no collection yet. Treat that
195+ # as an empty result rather than letting Qdrant raise a 404.
196+ if not await self .client .collection_exists (self .collection_name ):
197+ return QueryChunksResponse (chunks = [], scores = [])
198+
187199 try :
188200 # Use scroll for keyword-only search since query_points requires a query vector
189201 # Scroll allows filtering without a query vector
@@ -264,6 +276,12 @@ async def query_hybrid(
264276 if filters is not None :
265277 raise NotImplementedError ("Qdrant provider does not yet support native filtering" )
266278
279+ # Collections are created lazily on first insert, so a search against a
280+ # store that has never had chunks added has no collection yet. Treat that
281+ # as an empty result rather than letting Qdrant raise a 404.
282+ if not await self .client .collection_exists (self .collection_name ):
283+ return QueryChunksResponse (chunks = [], scores = [])
284+
267285 try :
268286 query_words = query_string .lower ().split ()
269287 if not query_words :
0 commit comments