diff --git a/mempalace/backends/milvus.py b/mempalace/backends/milvus.py index 9c460f1..b697c46 100644 --- a/mempalace/backends/milvus.py +++ b/mempalace/backends/milvus.py @@ -410,7 +410,7 @@ class MilvusCollection(BaseCollection): self._client, self._remote_collection, dimension, - enable_native_lexical=self._backend._enable_native_lexical(self._config), + enable_native_lexical=True, ) self._backend._load_remote_collection(self._client, self._remote_collection) self._known_dimension = dimension @@ -1085,10 +1085,6 @@ class MilvusBackend(BaseBackend): self._clients[config] = client return client - @staticmethod - def _enable_native_lexical(config: _MilvusConfig) -> bool: - return bool(config.uri and _is_server_uri(config.uri)) - def get_collection(self, *args, **kwargs) -> MilvusCollection: palace, collection_name, create, options = self._normalize_args(args, kwargs) config = self._effective_config(palace, options) @@ -1230,6 +1226,7 @@ class MilvusBackend(BaseBackend): datatype=DataType.VARCHAR, max_length=DOCUMENT_MAX_LENGTH, enable_analyzer=enable_native_lexical, + enable_match=enable_native_lexical, ) schema.add_field(field_name=FIELD_METADATA, datatype=DataType.JSON) schema.add_field( diff --git a/tests/test_milvus_backend.py b/tests/test_milvus_backend.py index 6fd7c5f..46a2243 100644 --- a/tests/test_milvus_backend.py +++ b/tests/test_milvus_backend.py @@ -85,6 +85,7 @@ def test_milvus_lite_add_query_filter_lexical_and_marker(tmp_path): assert MilvusBackend.detect(palace.local_path) assert os.path.isfile(os.path.join(palace.local_path, "milvus_backend.json")) assert os.path.exists(os.path.join(palace.local_path, "milvus.db")) + assert col._has_native_lexical() assert col.count() == 3 result = col.query(