Self-evolving Context Database for AI Agents. Unify Agent Memory, Knowledge RAG and Skills.
Python agent-contextagent-memoryagent-pluginsagentic-ragcontext-databasedsh-pluginknowledge-basememorymemory-managementself-evolvingvector-database
refactor(filter): replace prefix operator with must (#292)
kkkwjx5982d959772a
diff --git a/openviking/retrieve/hierarchical_retriever.py b/openviking/retrieve/hierarchical_retriever.pyindex 987978a4f..1e74e8de9 100644--- a/openviking/retrieve/hierarchical_retriever.py+++ b/openviking/retrieve/hierarchical_retriever.py@@ -118,7 +118,7 @@ class HierarchicalRetriever:target_filter = {"op": "or","conds": [- {"op": "prefix", "field": "uri", "prefix": target_dir}+ {"op": "must", "field": "uri", "conds": [target_dir]}for target_dir in target_dirs],}diff --git a/openviking/session/memory_deduplicator.py b/openviking/session/memory_deduplicator.pyindex 63b2e6692..37208b2a0 100644--- a/openviking/session/memory_deduplicator.py+++ b/openviking/session/memory_deduplicator.py@@ -148,7 +148,7 @@ class MemoryDeduplicator:)filter_conds.append({"field": "owner_space", "op": "must", "conds": [owner_space]})if category_uri_prefix:- filter_conds.append({"field": "uri", "op": "prefix", "prefix": category_uri_prefix})+ filter_conds.append({"field": "uri", "op": "must", "conds": [category_uri_prefix]})dedup_filter = {"op": "and", "conds": filter_conds}logger.debug("Dedup prefilter candidate category=%s filter=%s",diff --git a/openviking/storage/viking_fs.py b/openviking/storage/viking_fs.pyindex 00a09aaf5..2c42bc12f 100644--- a/openviking/storage/viking_fs.py+++ b/openviking/storage/viking_fs.py@@ -1031,7 +1031,7 @@ class VikingFS:"op": "or","conds": [{"op": "must", "field": "uri", "conds": [uri]},- {"op": "prefix", "field": "uri", "prefix": f"{uri}/"},+ {"op": "must", "field": "uri", "conds": [f"{uri}/"]},],},]diff --git a/openviking/storage/vikingdb_interface.py b/openviking/storage/vikingdb_interface.pyindex 6a29162d0..f11e81163 100644--- a/openviking/storage/vikingdb_interface.py+++ b/openviking/storage/vikingdb_interface.py@@ -325,7 +325,7 @@ class VikingDBInterface(ABC):"conds": [{"op": "must", "field": "name", "conds": [value]},{"op": "range", "field": "age", "gte": 18, "lt": 65},- {"op": "prefix", "field": "uri", "prefix": "viking://"},+ {"op": "must", "field": "uri", "conds": ["viking://"]},{"op": "contains", "field": "desc", "substring": "hello"}]}@@ -338,7 +338,7 @@ class VikingDBInterface(ABC):filter={"op": "and","conds": [- {"op": "prefix", "field": "uri", "prefix": "viking://user"},+ {"op": "must", "field": "uri", "conds": ["viking://user"]},{"op": "range", "field": "active_count", "gte": 1}]},