@@ -92,11 +92,13 @@ def filter_documents(self, filters: dict[str, Any] | None = None) -> list[Docume
9292 def _matches_filters (self , doc : Document , filters : dict [str , Any ]) -> bool :
9393 """
9494 Checks if a document matches the given filters.
95- Currently supports simple equality and comparison checks.
95+
96+ Currently, supports simple equality and comparison checks.
9697 """
9798 return self ._check_condition (doc , filters )
9899
99- def _get_doc_value (self , doc : Document , field : str ) -> Any :
100+ @staticmethod
101+ def _get_doc_value (doc : Document , field : str ) -> Any :
100102 """Helper to get value from doc, handling 'meta.' prefix."""
101103 if field == "content" :
102104 return doc .content
@@ -304,7 +306,7 @@ def _check_condition(self, doc: Document, condition: dict[str, Any]) -> bool:
304306 raise FilterError (msg )
305307 value = condition .get ("value" )
306308
307- doc_val = self ._get_doc_value (doc , field )
309+ doc_val = FAISSDocumentStore ._get_doc_value (doc , field )
308310
309311 # Type check for comparison operators
310312 if operator in [">" , ">=" , "<" , "<=" ]:
@@ -431,7 +433,7 @@ def get_metadata_field_min_max(self, field_name: str) -> dict[str, Any]:
431433 values = []
432434 for doc in self .documents .values ():
433435 val = (
434- self ._get_doc_value (doc , field_name )
436+ FAISSDocumentStore ._get_doc_value (doc , field_name )
435437 if not field_name .startswith ("meta." )
436438 else doc .meta .get (field_name [5 :])
437439 )
@@ -453,7 +455,7 @@ def get_metadata_field_unique_values(self, field_name: str) -> list[Any]:
453455 values = set ()
454456 for doc in self .documents .values ():
455457 val = (
456- self ._get_doc_value (doc , field_name )
458+ FAISSDocumentStore ._get_doc_value (doc , field_name )
457459 if not field_name .startswith ("meta." )
458460 else doc .meta .get (field_name [5 :])
459461 )
@@ -475,7 +477,7 @@ def count_unique_metadata_by_filter(self, filters: dict[str, Any], fields: list[
475477 for field in fields :
476478 unique_vals = set ()
477479 for doc in filtered_docs :
478- val = self ._get_doc_value (doc , field )
480+ val = FAISSDocumentStore ._get_doc_value (doc , field )
479481 if val is not None :
480482 unique_vals .add (val )
481483 counts [field ] = len (unique_vals )
0 commit comments