![JAR search and dependency download from the Maven repository](/logo.png)
io.milvus.client.Index Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of milvus-sdk-java Show documentation
Show all versions of milvus-sdk-java Show documentation
Java SDK for Milvus, a distributed high-performance vector search engine.
update grpc to 1.42.1
update protobuf to 3.19.1
restore the calcDistance interface that is removed in 2.1.0-beta4
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package io.milvus.client;
import javax.annotation.Nonnull;
/** Represents an index containing indexType
and nList
*/
public class Index {
private final String collectionName;
private final IndexType indexType;
private final String paramsInJson;
private Index(@Nonnull Builder builder) {
this.collectionName = builder.collectionName;
this.indexType = builder.indexType;
this.paramsInJson = builder.paramsInJson;
}
public String getCollectionName() {
return collectionName;
}
public IndexType getIndexType() {
return indexType;
}
public String getParamsInJson() {
return paramsInJson;
}
@Override
public String toString() {
return "Index {"
+ "collectionName="
+ collectionName
+ ", indexType="
+ indexType
+ ", params="
+ paramsInJson
+ '}';
}
/** Builder for Index
*/
public static class Builder {
// Required parameters
private final String collectionName;
private final IndexType indexType;
// Optional parameters - initialized to default values
private String paramsInJson;
/**
* @param collectionName collection to create index on
* @param indexType a IndexType
object
*/
public Builder(@Nonnull String collectionName, @Nonnull IndexType indexType) {
this.collectionName = collectionName;
this.indexType = indexType;
}
/**
* Optional. Default to empty String
. Index parameters are different for different
* index types. Refer to https://milvus.io/docs/milvus_operation.md
* for more information.
*
*
* FLAT/IVFLAT/SQ8: {"nlist": 16384}
* nlist range:[1, 999999]
*
* IVFPQ: {"nlist": 16384, "m": 12}
* nlist range:[1, 999999]
* m is decided by dim and have a couple of results.
*
* NSG: {"search_length": 45, "out_degree": 50, "candidate_pool_size": 300, "knng": 100}
* search_length range:[10, 300]
* out_degree range:[5, 300]
* candidate_pool_size range:[50, 1000]
* knng range:[5, 300]
*
* HNSW: {"M": 16, "efConstruction": 500}
* M range:[5, 48]
* efConstruction range:[100, 500]
*
* ANNOY: {"n_trees": 4}
* n_trees range: [1, 16384)
*
*
* @param paramsInJson extra parameters in JSON format
* @return Builder
*/
public Builder withParamsInJson(@Nonnull String paramsInJson) {
this.paramsInJson = paramsInJson;
return this;
}
public Index build() {
return new Index(this);
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy