NewHNSWPRQAnnParam
This operation creates a search parameter configuration for an HNSW_PRQ index, tuning search-time behavior of a product-residual-quantized HNSW graph.
func NewHNSWPRQAnnParam(ef int) *hnswQuantAnnParam
Request Syntax
Creates a quantized-HNSW search parameter configuration with the given search effort ef.
NewHNSWPRQAnnParam(ef int) *hnswQuantAnnParam
PARAMETERS:
-
ef (int) -
[REQUIRED]
BUILDER METHODS:
-
WithRefineK(refineK float64) *hnswQuantAnnParamThis sets the refinement factor applied to quantized candidate distances.
-
WithSeedEf(seedEf int) *hnswQuantAnnParamThis sets the seed search effort used to warm up the graph search.
-
Params() map[string]anyThis returns the current search parameters as a map.
RETURN TYPE:
*hnswQuantAnnParam
RETURNS:
Returns the quantized-HNSW search parameter configuration.
PARAMETERS:
-
annParam (*hnswQuantAnnParam) -
The quantized-HNSW search parameter configuration. Pass it to the search or hybrid search option via WithAnnParam().
ERROR HANDLING:
-
error
Validation, request construction, or the RPC fails. Check the returned error for failure details.
Example
Demonstrates NewHNSWPRQAnnParam usage.
import (
"context"
"github.com/milvus-io/milvus/client/v3/entity"
"github.com/milvus-io/milvus/client/v3/index"
"github.com/milvus-io/milvus/client/v3/milvusclient"
)
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
cli, err := milvusclient.New(ctx, &milvusclient.ClientConfig{
Address: "YOUR_CLUSTER_ENDPOINT",
})
if err != nil {
// handle error
}
defer cli.Close(ctx)
resultSets, err := cli.Search(ctx, milvusclient.NewSearchOption("books", 10, vectors).
WithAnnParam(index.NewHNSWPRQAnnParam(64)))
if err != nil {
// handle error
}