Skip to content

Commit

Permalink
refactor: fix indentation
Browse files Browse the repository at this point in the history
  • Loading branch information
BorysTheDev committed Sep 3, 2024
1 parent bb1e996 commit 06c7fe8
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 23 deletions.
32 changes: 11 additions & 21 deletions src/server/search/search_family.cc
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,7 @@ search::SchemaField::VectorParams ParseVectorParams(CmdArgParser* parser) {
params.sim = parser->Switch("L2", search::VectorSimilarity::L2, "COSINE",
search::VectorSimilarity::COSINE);
} else if (parser->Check("INITIAL_CAP")) {
parser->Next<size_t>();
// params.capacity = parser->Next<size_t>();
params.capacity = parser->Next<size_t>();
} else if (parser->Check("M")) {
params.hnsw_m = parser->Next<size_t>();
} else if (parser->Check("EF_CONSTRUCTION")) {
Expand Down Expand Up @@ -216,25 +215,16 @@ optional<SearchParams> ParseSearchParamsOrReply(CmdArgParser parser, ConnectionC
string_view alias = parser.Check("AS") ? parser.Next() : ident;
params.return_fields->emplace_back(ident, alias);
}
} else

// NOCONTENT
if (parser.Check("NOCONTENT")) {
params.return_fields = SearchParams::FieldReturnList{};
} else

// [PARAMS num(ignored) name(ignored) knn_vector]
if (parser.Check("PARAMS")) {
params.query_params = ParseQueryParams(&parser);
} else

if (parser.Check("SORTBY")) {
params.sort_option =
search::SortOption{string{parser.Next()}, bool(parser.Check("DESC"))};
} else {
// Unsupported parameters are ignored for now
parser.Skip(1);
}
} else if (parser.Check("NOCONTENT")) { // NOCONTENT
params.return_fields = SearchParams::FieldReturnList{};
} else if (parser.Check("PARAMS")) { // [PARAMS num(ignored) name(ignored) knn_vector]
params.query_params = ParseQueryParams(&parser);
} else if (parser.Check("SORTBY")) {
params.sort_option = search::SortOption{string{parser.Next()}, bool(parser.Check("DESC"))};
} else {
// Unsupported parameters are ignored for now
parser.Skip(1);
}
}

if (auto err = parser.Error(); err) {
Expand Down
4 changes: 2 additions & 2 deletions tests/dragonfly/search_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -227,8 +227,8 @@ async def knn_query(idx, query, vector):


@dfly_args({"proactor_threads": 4})
@pytest.mark.parametrize("index_type", [IndexType.HASH])
@pytest.mark.parametrize("algo_type", ["FLAT"])
@pytest.mark.parametrize("index_type", [IndexType.HASH, IndexType.JSON])
@pytest.mark.parametrize("algo_type", ["FLAT", "HNSW"])
async def test_knn(async_client: aioredis.Redis, index_type, algo_type):
i2 = async_client.ft("i2-" + str(index_type))

Expand Down

0 comments on commit 06c7fe8

Please sign in to comment.