Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: support keyword text match #2256

Merged
merged 4 commits into from
Sep 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion pymilvus/client/check.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,12 @@ def is_correct_date_str(param: str) -> bool:


def is_legal_dimension(dim: Any) -> bool:
return isinstance(dim, int)
try:
_ = int(dim)
except ValueError:
return False

return True


def is_legal_index_size(index_size: Any) -> bool:
Expand Down
3 changes: 2 additions & 1 deletion pymilvus/client/prepare.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from typing import Any, Dict, Iterable, List, Mapping, Optional, Union

import numpy as np
import ujson

from pymilvus.exceptions import DataNotMatchException, ExceptionsMessage, ParamError
from pymilvus.grpc_gen import common_pb2 as common_types
Expand Down Expand Up @@ -134,7 +135,7 @@ def get_schema_from_collection_schema(
)
for k, v in f.params.items():
kv_pair = common_types.KeyValuePair(
key=str(k) if k != "mmap_enabled" else "mmap.enabled", value=str(v)
key=str(k) if k != "mmap_enabled" else "mmap.enabled", value=ujson.dumps(v)
)
field_schema.type_params.append(kv_pair)

Expand Down
2 changes: 1 addition & 1 deletion pymilvus/orm/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
# or implied. See the License for the specific language governing permissions and limitations under
# the License.

COMMON_TYPE_PARAMS = ("dim", "max_length", "max_capacity")
COMMON_TYPE_PARAMS = ("dim", "max_length", "max_capacity", "enable_match", "analyzer_params")

CALC_DIST_IDS = "ids"
CALC_DIST_FLOAT_VEC = "float_vectors"
Expand Down
3 changes: 1 addition & 2 deletions pymilvus/orm/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -354,13 +354,12 @@ def _parse_type_params(self):
return
if not self._kwargs:
return
# currently only support "dim", "max_length", "max_capacity"
if self._kwargs:
for k in COMMON_TYPE_PARAMS:
if k in self._kwargs:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

update comment in line 357

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK.

if self._type_params is None:
self._type_params = {}
self._type_params[k] = int(self._kwargs[k])
self._type_params[k] = self._kwargs[k]
Copy link
Contributor

@czs007 czs007 Sep 12, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

need modify is_legal_dimision to cover string format.


@classmethod
def construct_from_dict(cls, raw: Dict):
Expand Down