Skip to content

Commit 11d2fc0

Browse files
authored
feat: support keyword text match (#2256)
Signed-off-by: longjiquan <[email protected]>
1 parent baaca92 commit 11d2fc0

File tree

4 files changed

+10
-5
lines changed

4 files changed

+10
-5
lines changed

pymilvus/client/check.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,12 @@ def is_correct_date_str(param: str) -> bool:
5252

5353

5454
def is_legal_dimension(dim: Any) -> bool:
55-
return isinstance(dim, int)
55+
try:
56+
_ = int(dim)
57+
except ValueError:
58+
return False
59+
60+
return True
5661

5762

5863
def is_legal_index_size(index_size: Any) -> bool:

pymilvus/client/prepare.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
from typing import Any, Dict, Iterable, List, Mapping, Optional, Union
44

55
import numpy as np
6+
import ujson
67

78
from pymilvus.exceptions import DataNotMatchException, ExceptionsMessage, ParamError
89
from pymilvus.grpc_gen import common_pb2 as common_types
@@ -136,7 +137,7 @@ def get_schema_from_collection_schema(
136137
)
137138
for k, v in f.params.items():
138139
kv_pair = common_types.KeyValuePair(
139-
key=str(k) if k != "mmap_enabled" else "mmap.enabled", value=str(v)
140+
key=str(k) if k != "mmap_enabled" else "mmap.enabled", value=ujson.dumps(v)
140141
)
141142
field_schema.type_params.append(kv_pair)
142143

pymilvus/orm/constants.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
# or implied. See the License for the specific language governing permissions and limitations under
1111
# the License.
1212

13-
COMMON_TYPE_PARAMS = ("dim", "max_length", "max_capacity")
13+
COMMON_TYPE_PARAMS = ("dim", "max_length", "max_capacity", "enable_match", "analyzer_params")
1414

1515
CALC_DIST_IDS = "ids"
1616
CALC_DIST_FLOAT_VEC = "float_vectors"

pymilvus/orm/schema.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -356,13 +356,12 @@ def _parse_type_params(self):
356356
return
357357
if not self._kwargs:
358358
return
359-
# currently only support "dim", "max_length", "max_capacity"
360359
if self._kwargs:
361360
for k in COMMON_TYPE_PARAMS:
362361
if k in self._kwargs:
363362
if self._type_params is None:
364363
self._type_params = {}
365-
self._type_params[k] = int(self._kwargs[k])
364+
self._type_params[k] = self._kwargs[k]
366365

367366
@classmethod
368367
def construct_from_dict(cls, raw: Dict):

0 commit comments

Comments
 (0)