diff --git a/milvus_cli/Index.py b/milvus_cli/Index.py index 6b1c123..4aa17c0 100644 --- a/milvus_cli/Index.py +++ b/milvus_cli/Index.py @@ -56,8 +56,8 @@ def get_index_details( rows.append(["Corresponding Field", index.field_name]) rows.append(["Index Name", index.index_name]) - rows.append(["Index Type", index.params["index_type"]]) - rows.append(["Metric Type", index.params["metric_type"]]) + rows.append(["Index Type", index.params.get("index_type", "")]) + rows.append(["Metric Type", index.params.get("metric_type", "")]) params = index.params.get("params", {}) paramsDetails = "\n- ".join(map(lambda k: f"{k[0]}: {k[1]}", params.items())) diff --git a/milvus_cli/scripts/data_cli.py b/milvus_cli/scripts/data_cli.py index ae059a8..e433358 100644 --- a/milvus_cli/scripts/data_cli.py +++ b/milvus_cli/scripts/data_cli.py @@ -262,17 +262,19 @@ def search(obj): type=click.Choice(obj.collection.list_field_names(collectionName)), ) indexes = obj.index.list_indexes(collectionName, onlyData=True) + indexDetails = None for index in indexes: if index.field_name == annsField: indexDetails = index break + hasIndex = not not indexDetails if indexDetails: - index_type = indexDetails._index_params["index_type"] - search_parameters = IndexTypesMap[index_type]["search_parameters"] - metric_type = indexDetails._index_params["metric_type"] + index_type = indexDetails._index_params.get("index_type", "AUTOINDEX") + metric_type = indexDetails._index_params.get("metric_type", "") click.echo(f"Metric type: {metric_type}") metricType = metric_type + search_parameters = IndexTypesMap[index_type]["search_parameters"] params = [] for parameter in search_parameters: paramInput = click.prompt(f"Search parameter {parameter}'s value") @@ -282,11 +284,11 @@ def search(obj): params = [] groupByField = click.prompt( - "Groups search results by a specified field to ensure diversity and avoid returning multiple results from the same group.", - default=None, + "Groups search by Field", + default="", type=str, ) - if groupByField != None: + if groupByField != "": params += [f"group_by_field:{groupByField}"] roundDecimal = click.prompt( "The specified number of decimal places of returned distance", diff --git a/setup.py b/setup.py index 234d967..830773f 100644 --- a/setup.py +++ b/setup.py @@ -5,7 +5,7 @@ setup( name="milvus_cli", - version="v0.4.3", + version="v1.0.0", author="Milvus Team", author_email="milvus-team@zilliz.com", url="https://github.com/zilliztech/milvus_cli",