@@ -608,7 +608,11 @@ def _sort_by_index_name(
608
608
609
609
610
610
def retrieve_vector_index_info (
611
- driver : neo4j .Driver , index_name : str , label_or_type : str , embedding_property : str
611
+ driver : neo4j .Driver ,
612
+ index_name : str ,
613
+ label_or_type : str ,
614
+ embedding_property : str ,
615
+ neo4j_database : Optional [str ] = None ,
612
616
) -> Optional [neo4j .Record ]:
613
617
"""
614
618
Check if a vector index exists in a Neo4j database and return its
@@ -621,6 +625,9 @@ def retrieve_vector_index_info(
621
625
of the index.
622
626
embedding_property (str): The name of the property containing the
623
627
embeddings.
628
+ neo4j_database (Optional[str]): The name of the Neo4j database.
629
+ If not provided, this defaults to the server's default database ("neo4j" by default)
630
+ (`see reference to documentation <https://neo4j.com/docs/operations-manual/current/database-administration/#manage-databases-default>`_).
624
631
625
632
Returns:
626
633
Optional[Dict[str, Any]]:
@@ -640,6 +647,7 @@ def retrieve_vector_index_info(
640
647
"label_or_type" : label_or_type ,
641
648
"embedding_property" : embedding_property ,
642
649
},
650
+ database_ = neo4j_database ,
643
651
)
644
652
index_information = _sort_by_index_name (result .records , index_name )
645
653
if len (index_information ) > 0 :
@@ -653,6 +661,7 @@ def retrieve_fulltext_index_info(
653
661
index_name : str ,
654
662
label_or_type : str ,
655
663
text_properties : List [str ] = [],
664
+ neo4j_database : Optional [str ] = None ,
656
665
) -> Optional [neo4j .Record ]:
657
666
"""
658
667
Check if a full text index exists in a Neo4j database and return its
@@ -664,6 +673,9 @@ def retrieve_fulltext_index_info(
664
673
label_or_type (str): The label (for nodes) or type (for relationships)
665
674
of the index.
666
675
text_properties (List[str]): The names of the text properties indexed.
676
+ neo4j_database (Optional[str]): The name of the Neo4j database.
677
+ If not provided, this defaults to the server's default database ("neo4j" by default)
678
+ (`see reference to documentation <https://neo4j.com/docs/operations-manual/current/database-administration/#manage-databases-default>`_).
667
679
668
680
Returns:
669
681
Optional[Dict[str, Any]]:
@@ -683,6 +695,7 @@ def retrieve_fulltext_index_info(
683
695
"label_or_type" : label_or_type ,
684
696
"text_properties" : text_properties ,
685
697
},
698
+ database_ = neo4j_database ,
686
699
)
687
700
index_information = _sort_by_index_name (result .records , index_name )
688
701
if len (index_information ) > 0 :
0 commit comments