@@ -214,7 +214,7 @@ Release the synchronous resources of the underlying Document Store.
214214
215215### AlloyDBDocumentStore
216216
217- Bases: <code >DocumentStore </code >
217+ Bases: <code >PgvectorDocumentStore </code >
218218
219219A Document Store backed by [ Google Cloud AlloyDB] ( https://cloud.google.com/alloydb ) .
220220
@@ -226,9 +226,15 @@ Connection is handled securely via the
226226which provides TLS encryption and IAM-based authorization without requiring manual SSL certificate
227227management, firewall rules, or IP allowlisting.
228228
229+ This store extends ` PgvectorDocumentStore ` and only changes how the connection is opened, so all
230+ document, filtering, metadata and retrieval operations behave as in ` PgvectorDocumentStore ` .
231+
229232** Filter limitations** : the ` NOT ` logical operator is not supported. Use ` != ` or ` not in `
230233comparison operators to express negation.
231234
235+ ** Async** : the async methods are not supported, because the AlloyDB Python Connector does not
236+ provide async psycopg connections. They raise ` NotImplementedError ` .
237+
232238Usage example:
233239
234240``` python
@@ -372,252 +378,4 @@ Deserializes the component from a dictionary.
372378close() -> None
373379```
374380
375- Release the associated synchronous resources.
376-
377- #### delete_table
378-
379- ``` python
380- delete_table() -> None
381- ```
382-
383- Deletes the table used to store Haystack documents.
384-
385- The name of the schema (` schema_name ` ) and the name of the table (` table_name ` )
386- are defined when initializing the ` AlloyDBDocumentStore ` .
387-
388- #### count_documents
389-
390- ``` python
391- count_documents() -> int
392- ```
393-
394- Returns how many documents are in the document store.
395-
396- ** Returns:**
397-
398- - <code >int</code > – The number of documents in the document store.
399-
400- #### filter_documents
401-
402- ``` python
403- filter_documents(filters: dict[str , Any] | None = None ) -> list[Document]
404- ```
405-
406- Returns the documents that match the filters provided.
407-
408- For a detailed specification of the filters,
409- refer to the [ documentation] ( https://docs.haystack.deepset.ai/docs/metadata-filtering )
410-
411- ** Filter operator support** : comparison operators (` == ` , ` != ` , ` > ` , ` >= ` , ` < ` , ` <= ` , ` in ` ,
412- ` not in ` , ` like ` , ` not like ` ) and logical operators ` AND ` and ` OR ` are fully supported.
413- The ` NOT ` logical operator is ** not** supported — use ` != ` or ` not in ` comparison
414- operators instead.
415-
416- ** Parameters:**
417-
418- - ** filters** (<code >dict\[ str, Any\] | None</code >) – The filters to apply to the document list.
419-
420- ** Returns:**
421-
422- - <code >list\[ Document\] </code > – A list of Documents that match the given filters.
423-
424- ** Raises:**
425-
426- - <code >TypeError</code > – If ` filters ` is not a dictionary.
427- - <code >ValueError</code > – If ` filters ` syntax is invalid.
428-
429- #### write_documents
430-
431- ``` python
432- write_documents(
433- documents: list[Document], policy: DuplicatePolicy = DuplicatePolicy.FAIL
434- ) -> int
435- ```
436-
437- Writes documents to the document store.
438-
439- ** Parameters:**
440-
441- - ** documents** (<code >list\[ Document\] </code >) – A list of Documents to write to the document store.
442- - ** policy** (<code >DuplicatePolicy</code >) – The duplicate policy to use when writing documents.
443-
444- ** Returns:**
445-
446- - <code >int</code > – The number of documents written to the document store.
447-
448- ** Raises:**
449-
450- - <code >ValueError</code > – If ` documents ` contains objects that are not of type ` Document ` .
451- - <code >DuplicateDocumentError</code > – If a document with the same id already exists in the document store
452- and the policy is set to ` DuplicatePolicy.FAIL ` (or not specified).
453- - <code >DocumentStoreError</code > – If the write operation fails for any other reason.
454-
455- #### delete_documents
456-
457- ``` python
458- delete_documents(document_ids: list[str ]) -> None
459- ```
460-
461- Deletes documents that match the provided ` document_ids ` from the document store.
462-
463- ** Parameters:**
464-
465- - ** document_ids** (<code >list\[ str\] </code >) – the document ids to delete
466-
467- #### delete_all_documents
468-
469- ``` python
470- delete_all_documents() -> None
471- ```
472-
473- Deletes all documents in the document store.
474-
475- #### delete_by_filter
476-
477- ``` python
478- delete_by_filter(filters: dict[str , Any]) -> int
479- ```
480-
481- Deletes all documents that match the provided filters.
482-
483- ** Parameters:**
484-
485- - ** filters** (<code >dict\[ str, Any\] </code >) – The filters to apply to select documents for deletion.
486- For filter syntax, see [ Haystack metadata filtering] ( https://docs.haystack.deepset.ai/docs/metadata-filtering )
487-
488- ** Returns:**
489-
490- - <code >int</code > – The number of documents deleted.
491-
492- #### update_by_filter
493-
494- ``` python
495- update_by_filter(filters: dict[str , Any], meta: dict[str , Any]) -> int
496- ```
497-
498- Updates the metadata of all documents that match the provided filters.
499-
500- ** Parameters:**
501-
502- - ** filters** (<code >dict\[ str, Any\] </code >) – The filters to apply to select documents for updating.
503- For filter syntax, see [ Haystack metadata filtering] ( https://docs.haystack.deepset.ai/docs/metadata-filtering )
504- - ** meta** (<code >dict\[ str, Any\] </code >) – The metadata fields to update.
505-
506- ** Returns:**
507-
508- - <code >int</code > – The number of documents updated.
509-
510- #### count_documents_by_filter
511-
512- ``` python
513- count_documents_by_filter(filters: dict[str , Any]) -> int
514- ```
515-
516- Returns the number of documents that match the provided filters.
517-
518- ** Parameters:**
519-
520- - ** filters** (<code >dict\[ str, Any\] </code >) – The filters to apply to count documents.
521- For filter syntax, see [ Haystack metadata filtering] ( https://docs.haystack.deepset.ai/docs/metadata-filtering )
522-
523- ** Returns:**
524-
525- - <code >int</code > – The number of documents that match the filters.
526-
527- #### count_unique_metadata_by_filter
528-
529- ``` python
530- count_unique_metadata_by_filter(
531- filters: dict[str , Any], metadata_fields: list[str ]
532- ) -> dict[str , int ]
533- ```
534-
535- Returns the count of unique values for each specified metadata field.
536-
537- Considers only documents that match the provided filters.
538-
539- ** Parameters:**
540-
541- - ** filters** (<code >dict\[ str, Any\] </code >) – The filters to apply to select documents.
542- For filter syntax, see [ Haystack metadata filtering] ( https://docs.haystack.deepset.ai/docs/metadata-filtering )
543- - ** metadata_fields** (<code >list\[ str\] </code >) – List of metadata field names to count unique values for.
544- Field names can include or omit the "meta." prefix.
545-
546- ** Returns:**
547-
548- - <code >dict\[ str, int\] </code > – A dictionary mapping field names to their unique value counts.
549-
550- #### get_metadata_fields_info
551-
552- ``` python
553- get_metadata_fields_info() -> dict[str , dict[str , str ]]
554- ```
555-
556- Returns information about the metadata fields in the document store.
557-
558- Since metadata is stored in a JSONB field, this method analyzes actual data
559- to infer field types.
560-
561- Example return:
562-
563- ``` python
564- {
565- ' category' : {' type' : ' text' },
566- ' priority' : {' type' : ' integer' },
567- }
568- ```
569-
570- ** Returns:**
571-
572- - <code >dict\[ str, dict\[ str, str\]\] </code > – A dictionary mapping field names to their type information.
573-
574- #### get_metadata_field_min_max
575-
576- ``` python
577- get_metadata_field_min_max(field: str ) -> dict[str , Any]
578- ```
579-
580- Returns the minimum and maximum values for a metadata field.
581-
582- For numeric fields (integer, real), returns numeric min/max.
583- For text and other non-numeric fields, returns lexicographic min/max
584- using the ` "C" ` collation.
585-
586- ** Parameters:**
587-
588- - ** field** (<code >str</code >) – The metadata field name (with or without the "meta." prefix).
589-
590- ** Returns:**
591-
592- - <code >dict\[ str, Any\] </code > – A dictionary with ` min ` and ` max ` keys. Returns
593- ` {"min": None, "max": None} ` when the field has no values or the
594- store is empty.
595-
596- #### get_metadata_field_unique_values
597-
598- ``` python
599- get_metadata_field_unique_values(
600- metadata_field: str ,
601- search_term: str | None = None ,
602- from_: int = 0 ,
603- size: int = 10 ,
604- filters: dict[str , Any] | None = None ,
605- ) -> tuple[list[Any], int ]
606- ```
607-
608- Returns unique values for a given metadata field, optionally restricted by filters and/or a search term.
609-
610- ** Parameters:**
611-
612- - ** metadata_field** (<code >str</code >) – The metadata field name (with or without the "meta." prefix).
613- - ** search_term** (<code >str | None</code >) – Optional search term to filter unique values by a case-insensitive substring
614- match against the metadata field's own value. If None, all values are considered.
615- - ** from\_ ** (<code >int</code >) – The offset for pagination (0-based).
616- - ** size** (<code >int</code >) – The number of unique values to return.
617- - ** filters** (<code >dict\[ str, Any\] | None</code >) – Optional filters to restrict the documents considered.
618-
619- ** Returns:**
620-
621- - <code >tuple\[ list\[ Any\] , int\] </code > – A tuple containing:
622- - A list of unique values in their original type
623- - The total count of unique values
381+ Release the associated synchronous resources, including the AlloyDB Python Connector.
0 commit comments