Skip to content

Commit b82af21

Browse files
baranchenariesshenCaralHsi
authored
fix(graph_dbs): add missing status parameter to Neo4jCommunityGraphDB… (#1179)
fix(graph_dbs): add missing status parameter to Neo4jCommunityGraphDB.get_by_metadata The get_by_metadata method in neo4j_community.py was missing the `status` parameter that exists in the base class and other implementations (neo4j.py, postgres.py). This caused "unexpected keyword argument 'status'" errors when the search API tried to filter by status. Changes: - Add `user_name_flag: bool = True` parameter for consistency - Add `status: str | None = None` parameter - Add status filter logic in WHERE clause when status is provided - Update log messages to include status parameter Fixes search functionality when using Neo4j Community Edition backend. Co-authored-by: ariesshen <ariesshen@ariesshendeMac.local> Co-authored-by: CaralHsi <caralhsi@gmail.com>
1 parent 6d2d965 commit b82af21

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

src/memos/graph_dbs/neo4j_community.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -721,6 +721,8 @@ def get_by_metadata(
721721
user_name: str | None = None,
722722
filter: dict | None = None,
723723
knowledgebase_ids: list[str] | None = None,
724+
user_name_flag: bool = True,
725+
status: str | None = None,
724726
) -> list[str]:
725727
"""
726728
Retrieve node IDs that match given metadata filters.
@@ -745,15 +747,20 @@ def get_by_metadata(
745747
- Can be used for faceted recall or prefiltering before embedding rerank.
746748
"""
747749
logger.info(
748-
f"[get_by_metadata] filters: {filters},user_name: {user_name},filter: {filter},knowledgebase_ids: {knowledgebase_ids}"
750+
f"[get_by_metadata] filters: {filters},user_name: {user_name},filter: {filter},knowledgebase_ids: {knowledgebase_ids},status: {status}"
749751
)
750752
print(
751-
f"[get_by_metadata] filters: {filters},user_name: {user_name},filter: {filter},knowledgebase_ids: {knowledgebase_ids}"
753+
f"[get_by_metadata] filters: {filters},user_name: {user_name},filter: {filter},knowledgebase_ids: {knowledgebase_ids},status: {status}"
752754
)
753755
user_name = user_name if user_name else self.config.user_name
754756
where_clauses = []
755757
params = {}
756758

759+
# Add status filter if provided
760+
if status:
761+
where_clauses.append("n.status = $status")
762+
params["status"] = status
763+
757764
for i, f in enumerate(filters):
758765
field = f["field"]
759766
op = f.get("op", "=")

0 commit comments

Comments
 (0)