@@ -174,47 +174,51 @@ def vector_count(store: Qdrant) -> int:
174174 """
175175 try :
176176 if store is None :
177+ print ("⚠️ Store is None, returning 0" )
177178 return 0
178179
180+ print (f"🔍 Getting count for collection: { store .collection_name } " )
181+
179182 # Get collection info
180183 collection_info = store .client .get_collection (store .collection_name )
184+ print (f"🔍 Collection info type: { type (collection_info )} " )
185+ print (f"🔍 Collection info attributes: { [attr for attr in dir (collection_info ) if not attr .startswith ('_' )]} " )
181186
182187 # Try different attributes for count
183188 if hasattr (collection_info , 'vectors_count' ):
184189 count = collection_info .vectors_count
185- print (f"Vector count (vectors_count): { count } " )
190+ print (f"✅ Vector count (vectors_count): { count } " )
186191 return count
187192 elif hasattr (collection_info , 'points_count' ):
188193 count = collection_info .points_count
189- print (f"Vector count (points_count): { count } " )
194+ print (f"✅ Vector count (points_count): { count } " )
190195 return count
191196 elif hasattr (collection_info , 'status' ) and hasattr (collection_info .status , 'vectors_count' ):
192197 count = collection_info .status .vectors_count
193- print (f"Vector count (status.vectors_count): { count } " )
198+ print (f"✅ Vector count (status.vectors_count): { count } " )
194199 return count
195200 else :
196- print (f"⚠️ Collection info attributes: { dir (collection_info )} " )
197- return 0
198-
199- except Exception as e :
200- print (f"⚠️ Could not get vector count: { e } " )
201- # Try alternative method using search
202- try :
203- if hasattr (store , 'client' ) and hasattr (store , 'collection_name' ):
204- # Try to search for all points to get count
201+ print (f"⚠️ No count attribute found, trying scroll method" )
202+ # Try scroll method
203+ try :
205204 result = store .client .scroll (
206205 collection_name = store .collection_name ,
207- limit = 10000 # Large limit to get all points
206+ limit = 10000
208207 )
209208 if result and hasattr (result , 'points' ):
210209 count = len (result .points )
211- print (f"Vector count (scroll method): { count } " )
210+ print (f"✅ Vector count (scroll method): { count } " )
212211 return count
213- except Exception as e2 :
214- print (f"⚠️ Alternative count method failed: { e2 } " )
212+ except Exception as e3 :
213+ print (f"⚠️ Scroll method failed: { e3 } " )
214+
215+ print (f"⚠️ All count methods failed, returning 0" )
216+ return 0
215217
216- # Final fallback - return 0 if we can't get count
217- print ("⚠️ Using fallback count: 0" )
218+ except Exception as e :
219+ print (f"❌ Could not get vector count: { e } " )
220+ import traceback
221+ traceback .print_exc ()
218222 return 0
219223
220224def ensure_embedding_function (store : Qdrant , embedding ) -> Qdrant :
0 commit comments