From 06c7fe8102aea74ade7bdaf6f452f6d1905dabc9 Mon Sep 17 00:00:00 2001 From: Borys Date: Mon, 2 Sep 2024 18:55:06 +0300 Subject: [PATCH] refactor: fix indentation --- src/server/search/search_family.cc | 32 ++++++++++-------------------- tests/dragonfly/search_test.py | 4 ++-- 2 files changed, 13 insertions(+), 23 deletions(-) diff --git a/src/server/search/search_family.cc b/src/server/search/search_family.cc index 4c821877d921..e2e341f07d99 100644 --- a/src/server/search/search_family.cc +++ b/src/server/search/search_family.cc @@ -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(); - // params.capacity = parser->Next(); + params.capacity = parser->Next(); } else if (parser->Check("M")) { params.hnsw_m = parser->Next(); } else if (parser->Check("EF_CONSTRUCTION")) { @@ -216,25 +215,16 @@ optional 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) { diff --git a/tests/dragonfly/search_test.py b/tests/dragonfly/search_test.py index 4c7f5dd5c167..e5f1609a9cd5 100644 --- a/tests/dragonfly/search_test.py +++ b/tests/dragonfly/search_test.py @@ -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))