Skip to content

Commit

Permalink
chore: add parsing support for the rest of VECTOR parameters (#3179)
Browse files Browse the repository at this point in the history
  • Loading branch information
romange authored Jun 16, 2024
1 parent 4f1be8f commit 32844e0
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 4 deletions.
9 changes: 6 additions & 3 deletions src/core/search/indices.cc
Original file line number Diff line number Diff line change
Expand Up @@ -196,9 +196,12 @@ const float* FlatVectorIndex::Get(DocId doc) const {

struct HnswlibAdapter {
HnswlibAdapter(const SchemaField::VectorParams& params)
: space_{MakeSpace(params.dim, params.sim)}, world_{GetSpacePtr(), params.capacity,
params.hnsw_m, 200,
100, true} {
: space_{MakeSpace(params.dim, params.sim)}, world_{GetSpacePtr(),
params.capacity,
params.hnsw_m,
params.hnsw_ef_construction,
100 /* seed*/,
true} {
}

void Add(float* data, DocId id) {
Expand Down
2 changes: 1 addition & 1 deletion src/core/search/search.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ struct SchemaField {
size_t dim = 0u; // dimension of knn vectors
VectorSimilarity sim = VectorSimilarity::L2; // similarity type
size_t capacity = 1000; // initial capacity

size_t hnsw_ef_construction = 200;
size_t hnsw_m = 16;
};

Expand Down
17 changes: 17 additions & 0 deletions src/server/search/search_family.cc
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,23 @@ search::SchemaField::VectorParams ParseVectorParams(CmdArgParser* parser) {
continue;
}

if (parser->Check("EF_CONSTRUCTION").ExpectTail(1)) {
params.hnsw_ef_construction = parser->Next<size_t>();
continue;
}

if (parser->Check("EF_RUNTIME").ExpectTail(1)) {
parser->Next<size_t>();
LOG(WARNING) << "EF_RUNTIME not supported";
continue;
}

if (parser->Check("EPSILON").ExpectTail(1)) {
parser->Next<double>();
LOG(WARNING) << "EPSILON not supported";
continue;
}

parser->Skip(2);
}

Expand Down

0 comments on commit 32844e0

Please sign in to comment.