Skip to content

feat: The database search methods should support specifying fields to be returned. #955

@bittergreen

Description

@bittergreen

Pre-submission checklist | 提交前检查

  • I have searched existing issues and this hasn't been mentioned before | 我已搜索现有问题,确认此问题尚未被提及
  • I have read the project documentation and confirmed this issue doesn't already exist | 我已阅读项目文档并确认此问题尚未存在
  • This issue is specific to MemOS and not a general software issue | 该问题是针对 MemOS 的,而不是一般软件问题

Problem Statement | 问题陈述

In polardb.py, neo4j.py, and neo4j_community.py, the methods search_by_keywords_like, search_by_keywords_tfidf, search_by_fulltext, and search_by_embedding currently only return id and score in a fixed manner. If other fields are needed, you have to use the id to call get_node for another retrieval, which causes additional latency.

I hope to add a new return_fields: List[str] parameter to these methods, allowing you to pass in the desired field names, such as return_fields=["id", "memory", "status", "tags"], and include these fields + score in the returned dict.

This new field can have a default value of return_fields=["id"], so it won't affect previous calls.

Willingness to Implement | 实现意愿

  • I'm willing to implement this myself | 我愿意自己解决
  • I would like someone else to implement this | 我希望其他人来解决

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestpendingPending items to be addressed | 待解决事项。

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions