Open Source alternative to Algolia + Pinecone and an Easier-to-Use alternative to ElasticSearch ⚡ 🔍 ✨ Fast, typo tolerant, in-memory fuzzy Search Engine for building delightful search experiences
C++ algoliadatastoreelasticsearchenterprise-searchfacetingfull-text-searchfuzzy-searchgeosearchin-memoryinstantsearchmerchandisingpineconesearchsearch-enginesemantic-searchsimilarity-searchsite-searchsynonymstypo-tolerancevector-search
Rename `token_ranking_field` to `default_sorting_field` and make it mandatory.
Kishore Nallanca2c084d8697
diff --git a/README.md b/README.mdindex f66c0adb..f4469a9e 100644--- a/README.md+++ b/README.md@@ -54,7 +54,7 @@ typesense.Collections.create({{"name": "num_employees", "type": "int32" },{"name": "country", "type": "string", "facet": true }],- "token_ranking_field": "num_employees"+ "default_sorting_field": "num_employees"})```diff --git a/TODO.md b/TODO.mdindex e07ea499..19eaa86f 100644--- a/TODO.md+++ b/TODO.md@@ -53,7 +53,7 @@- ~~Test for collection creation validation~~- ~~Test for delete document~~- ~~art float search~~-- ~~When prefix=true, use token_ranking_field for token ordering only for last word~~+- ~~When prefix=true, use default_sorting_field for token ordering only for last word~~- ~~only last token should be prefix searched~~- ~~Prefix-search strings should not be null terminated~~- ~~sort results by float field~~@@ -71,7 +71,7 @@- ~~facet fields should be indexed verbatim~~- ~~change "search_by" to "query_by"~~- ~~during index_in_memory() validations should be front loaded~~-- ~~Support token ranking field being a float~~+- ~~Support default sorting field being a float~~- ~~https support~~- ~~Validate before string to int conversion in the http api layer~~- ~~art bool support~~@@ -94,6 +94,7 @@- ~~Deprecate union type punning~~- ~~Replica server should fail when pointed to "old" master~~- ~~gzip compress responses~~+- Have a LOG(ERROR) level- Parameterize replica's MAX_UPDATES_TO_SEND- NOT operator support- > INT32_MAX validation for float fielddiff --git a/include/collection.h b/include/collection.hindex 2bd98c9a..13f89a41 100644--- a/include/collection.h+++ b/include/collection.h@@ -42,7 +42,7 @@ private:std::unordered_map<std::string, field> sort_schema;- std::string token_ranking_field;+ std::string default_sorting_field;size_t num_indices;@@ -56,7 +56,7 @@ public:Collection() = delete;Collection(const std::string name, const uint32_t collection_id, const uint32_t next_seq_id, Store *store,- const std::vector<field> & fields, const std::string & token_ranking_field, const size_t num_indices=4);+ const std::vector<field> & fields, const std::string & default_sorting_field, const size_t num_indices=4);~Collection();@@ -88,7 +88,7 @@ public:std::unordered_map<std::string, field> get_schema();- std::string get_token_ranking_field();+ std::string get_default_sorting_field();Option<nlohmann::json> add(const std::string & json_str);diff --git a/include/collection_manager.h b/include/collection_manager.hindex 514d720a..dfcf9382 100644--- a/include/collection_manager.h+++ b/include/collection_manager.h@@ -23,7 +23,7 @@ private:static constexpr const char* COLLECTION_NAME_KEY = "name";static constexpr const char* COLLECTION_ID_KEY = "id";static constexpr const char* COLLECTION_SEARCH_FIELDS_KEY = "fields";- static constexpr const char* COLLECTION_TOKEN_ORDERING_FIELD_KEY = "token_ranking_field";+ static constexpr const char* COLLECTION_DEFAULT_SORTING_FIELD_KEY = "default_sorting_field";std::string auth_key;std::string search_only_auth_key;@@ -54,8 +54,8 @@ public:bool search_only_auth_key_matches(std::string auth_key_sent);- Option<Collection*> create_collection(std::string name, const std::vector<field> & fields,- const std::string & token_ranking_field = "");+ Option<Collection*> create_collection(const std::string name, const std::vector<field> & fields,+ const std::string & default_sorting_field);Collection* get_collection(const std::string & collection_name);diff --git a/src/api.cpp b/src/api.cppindex 06c4dc89..3b9ceeef 100644--- a/src/api.cpp+++ b/src/api.cpp@@ -26,7 +26,7 @@ nlohmann::json collection_summary_json(Collection *collection) {}json_response["fields"] = fields_arr;- json_response["token_ranking_field"] = collection->get_token_ranking_field();+ json_response["default_sorting_field"] = collection->get_default_sorting_field();return json_response;}@@ -74,6 +74,17 @@ void post_create_collection(http_req & req, http_res & res) {return res.send_400("Parameter `fields` is required.");}+ const char* DEFAULT_SORTING_FIELD = "default_sorting_field";++ if(req_json.count(DEFAULT_SORTING_FIELD) == 0) {+ return res.send_400("Parameter `default_sorting_field` is required.");+ }++ if(!req_json[DEFAULT_SORTING_FIELD].is_string()) {+ return res.send_400(std::string("`") + DEFAULT_SORTING_FIELD ++ "` should be a string. It should be the name of an unsigned integer field.");+ }+if(collectionManager.get_collection(req_json["name"]) != nullptr) {return res.send_409("Collection with name `" + req_json["name"].get<std::string>() + "` already exists.");}@@ -110,19 +121,8 @@ void post_create_collection(http_req & req, http_res & res) {);}- const char* TOKEN_RANKING_FIELD = "token_ranking_field";- std::string token_ranking_field = "";-- if(req_json.count(TOKEN_RANKING_FIELD) != 0) {- if(!req_json[TOKEN_RANKING_FIELD].is_string()) {- return res.send_400(std::string("`") + TOKEN_RANKING_FIELD +- "` should be a string. It should be the name of an unsigned integer field.");- }-- token_ranking_field = req_json[TOKEN_RANKING_FIELD].get<std::string>();- }-- collectionManager.create_collection(req_json["name"], fields, token_ranking_field);+ const std::string & default_sorting_field = req_json[DEFAULT_SORTING_FIELD].get<std::string>();+ collectionManager.create_collection(req_json["name"], fields, default_sorting_field);res.send_201(req.body);}@@ -242,15 +242,15 @@ void get_search(http_req & req, http_res & res) {bool prefix = (req.params[PREFIX] == "true");if(req.params.count(RANK_TOKENS_BY) == 0) {- if(prefix && !collection->get_token_ranking_field().empty()) {- req.params[RANK_TOKENS_BY] = "TOKEN_RANKING_FIELD";+ if(prefix && !collection->get_default_sorting_field().empty()) {+ req.params[RANK_TOKENS_BY] = "DEFAULT_SORTING_FIELD";} else {req.params[RANK_TOKENS_BY] = "TERM_FREQUENCY";}}StringUtils::toupper(req.params[RANK_TOKENS_BY]);- token_ordering token_order = (req.params[RANK_TOKENS_BY] == "TOKEN_RANKING_FIELD") ? MAX_SCORE : FREQUENCY;+ token_ordering token_order = (req.params[RANK_TOKENS_BY] == "DEFAULT_SORTING_FIELD") ? MAX_SCORE : FREQUENCY;Option<nlohmann::json> result_op = collection->search(req.params[QUERY], search_fields, filter_str, facet_fields,sort_fields, std::stoi(req.params[NUM_TYPOS]),diff --git a/src/collection.cpp b/src/collection.cppindex c808d853..6a374316 100644--- a/src/collection.cpp+++ b/src/collection.cpp@@ -12,10 +12,10 @@#include "logger.h"Collection::Collection(const std::string name, const uint32_t collection_id, const uint32_t next_seq_id, Store *store,- const std::vector<field> &fields, const std::string & token_ranking_field,+ const std::vector<field> &fields, const std::string & default_sorting_field,const size_t num_indices):name(name), collection_id(collection_id), next_seq_id(next_seq_id), store(store),- fields(fields), token_ranking_field(token_ranking_field), num_indices(num_indices) {+ fields(fields), default_sorting_field(default_sorting_field), num_indices(num_indices) {for(const field& field: fields) {search_schema.emplace(field.name, field);@@ -111,24 +111,23 @@ Option<nlohmann::json> Collection::add(const std::string & json_str) {}Option<uint32_t> Collection::validate_index_in_memory(const nlohmann::json &document, uint32_t seq_id) {- if(!token_ranking_field.empty() && document.count(token_ranking_field) == 0) {- return Option<>(400, "Field `" + token_ranking_field + "` has been declared as a token ranking field, "+ if(document.count(default_sorting_field) == 0) {+ return Option<>(400, "Field `" + default_sorting_field + "` has been declared as a default sorting field, ""but is not found in the document.");}- if(!token_ranking_field.empty() && !document[token_ranking_field].is_number_integer() &&- !document[token_ranking_field].is_number_float()) {- return Option<>(400, "Token ranking field `" + token_ranking_field + "` must be a number.");+ if(!document[default_sorting_field].is_number_integer() && !document[default_sorting_field].is_number_float()) {+ return Option<>(400, "Default sorting field `" + default_sorting_field + "` must be a number.");}- if(!token_ranking_field.empty() && document[token_ranking_field].is_number_integer() &&- document[token_ranking_field].get<int64_t>() > std::numeric_limits<int32_t>::max()) {- return Option<>(400, "Token ranking field `" + token_ranking_field + "` exceeds maximum value of int32.");+ if(document[default_sorting_field].is_number_integer() &&+ document[default_sorting_field].get<int64_t>() > std::numeric_limits<int32_t>::max()) {+ return Option<>(400, "Default sorting field `" + default_sorting_field + "` exceeds maximum value of an int32.");}- if(!token_ranking_field.empty() && document[token_ranking_field].is_number_float() &&- document[token_ranking_field].get<float>() > std::numeric_limits<float>::max()) {- return Option<>(400, "Token ranking field `" + token_ranking_field + "` exceeds maximum value of a float.");+ if(document[default_sorting_field].is_number_float() &&+ document[default_sorting_field].get<float>() > std::numeric_limits<float>::max()) {+ return Option<>(400, "Default sorting field `" + default_sorting_field + "` exceeds maximum value of a float.");}for(const std::pair<std::string, field> & field_pair: search_schema) {@@ -242,15 +241,15 @@ Option<uint32_t> Collection::index_in_memory(const nlohmann::json &document, uinint32_t points = 0;- if(!token_ranking_field.empty()) {- if(document[token_ranking_field].is_number_float()) {+ if(!default_sorting_field.empty()) {+ if(document[default_sorting_field].is_number_float()) {// serialize float to an integer and reverse the inverted range- float n = document[token_ranking_field];+ float n = document[default_sorting_field];memcpy(&points, &n, sizeof(int32_t));points ^= ((points >> (std::numeric_limits<int32_t>::digits - 1)) | INT32_MIN);points = -1 * (INT32_MAX - points);} else {- points = document[token_ranking_field];+ points = document[default_sorting_field];}}@@ -802,6 +801,6 @@ std::string Collection::get_seq_id_collection_prefix() {return std::to_string(collection_id) + "_" + std::string(SEQ_ID_PREFIX);}-std::string Collection::get_token_ranking_field() {- return token_ranking_field;+std::string Collection::get_default_sorting_field() {+ return default_sorting_field;}\ No newline at end of filediff --git a/src/collection_manager.cpp b/src/collection_manager.cppindex ad234eb1..937422f6 100644--- a/src/collection_manager.cpp+++ b/src/collection_manager.cpp@@ -19,14 +19,14 @@ Collection* CollectionManager::init_collection(const nlohmann::json & collectionfields.push_back({it.value()[fields::name], it.value()[fields::type], it.value()[fields::facet]});}- std::string token_ranking_field = collection_meta[COLLECTION_TOKEN_ORDERING_FIELD_KEY].get<std::string>();+ std::string default_sorting_field = collection_meta[COLLECTION_DEFAULT_SORTING_FIELD_KEY].get<std::string>();Collection* collection = new Collection(this_collection_name,collection_meta[COLLECTION_ID_KEY].get<uint32_t>(),collection_next_seq_id,store,fields,- token_ranking_field);+ default_sorting_field);return collection;}@@ -141,8 +141,8 @@ bool CollectionManager::search_only_auth_key_matches(std::string auth_key_sent)return (search_only_auth_key == auth_key_sent);}-Option<Collection*> CollectionManager::create_collection(std::string name, const std::vector<field> & fields,- const std::string & token_ranking_field) {+Option<Collection*> CollectionManager::create_collection(const std::string name, const std::vector<field> & fields,+ const std::string & default_sorting_field) {if(store->contains(Collection::get_meta_key(name))) {return Option<Collection*>(409, std::string("A collection with name `") + name + "` already exists.");}@@ -161,9 +161,9 @@ Option<Collection*> CollectionManager::create_collection(std::string name, constcollection_meta[COLLECTION_NAME_KEY] = name;collection_meta[COLLECTION_ID_KEY] = next_collection_id;collection_meta[COLLECTION_SEARCH_FIELDS_KEY] = fields_json;- collection_meta[COLLECTION_TOKEN_ORDERING_FIELD_KEY] = token_ranking_field;+ collection_meta[COLLECTION_DEFAULT_SORTING_FIELD_KEY] = default_sorting_field;- Collection* new_collection = new Collection(name, next_collection_id, 0, store, fields, token_ranking_field);+ Collection* new_collection = new Collection(name, next_collection_id, 0, store, fields, default_sorting_field);next_collection_id++;rocksdb::WriteBatch batch;diff --git a/test/collection_manager_test.cpp b/test/collection_manager_test.cppindex 70d24d0c..e101a56d 100644--- a/test/collection_manager_test.cpp+++ b/test/collection_manager_test.cpp@@ -57,7 +57,7 @@ TEST_F(CollectionManagerTest, CollectionCreation) {ASSERT_EQ(1, collection1->get_sort_fields().size());ASSERT_EQ(sort_fields[0].name, collection1->get_sort_fields()[0].name);ASSERT_EQ(schema.size(), collection1->get_schema().size());- ASSERT_EQ("points", collection1->get_token_ranking_field());+ ASSERT_EQ("points", collection1->get_default_sorting_field());// check storage as wellrocksdb::Iterator* it = store->get_iterator();@@ -80,11 +80,11 @@ TEST_F(CollectionManagerTest, CollectionCreation) {ASSERT_EQ(3, num_keys);// we already call `collection1->get_next_seq_id` above, which is side-effectingASSERT_EQ(1, StringUtils::deserialize_uint32_t(next_seq_id));- ASSERT_EQ("{\"fields\":[{\"facet\":false,\"name\":\"title\",\"type\":\"string\"},"+ ASSERT_EQ("{\"default_sorting_field\":\"points\",\"fields\":[{\"facet\":false,\"name\":\"title\",\"type\":\"string\"},""{\"facet\":false,\"name\":\"starring\",\"type\":\"string\"},""{\"facet\":true,\"name\":\"cast\",\"type\":\"string[]\"},""{\"facet\":false,\"name\":\"points\",\"type\":\"int32\"}"- "],\"id\":0,\"name\":\"collection1\",\"token_ranking_field\":\"points\"}", collection_meta_json);+ "],\"id\":0,\"name\":\"collection1\"}", collection_meta_json);ASSERT_EQ("1", next_collection_id);}@@ -138,7 +138,7 @@ TEST_F(CollectionManagerTest, RestoreRecordsOnRestart) {ASSERT_EQ(1, collection1->get_sort_fields().size());ASSERT_EQ(sort_fields[0].name, collection1->get_sort_fields()[0].name);ASSERT_EQ(schema.size(), collection1->get_schema().size());- ASSERT_EQ("points", collection1->get_token_ranking_field());+ ASSERT_EQ("points", collection1->get_default_sorting_field());results = collection1->search("thomas", search_fields, "", facets, sort_fields, 0, 10, 1, FREQUENCY, false).get();ASSERT_EQ(4, results["hits"].size());diff --git a/test/collection_test.cpp b/test/collection_test.cppindex fca67ebe..5788a69b 100644--- a/test/collection_test.cpp+++ b/test/collection_test.cpp@@ -478,7 +478,7 @@ TEST_F(CollectionTest, MultipleFields) {coll_mul_fields = collectionManager.get_collection("coll_mul_fields");if(coll_mul_fields == nullptr) {- coll_mul_fields = collectionManager.create_collection("coll_mul_fields", fields).get();+ coll_mul_fields = collectionManager.create_collection("coll_mul_fields", fields, "points").get();}std::string json_line;@@ -491,6 +491,9 @@ TEST_F(CollectionTest, MultipleFields) {query_fields = {"title", "starring"};std::vector<std::string> facets;++ auto x = coll_mul_fields->search("Will", query_fields, "", facets, sort_fields, 0, 10, 1, FREQUENCY, false);+nlohmann::json results = coll_mul_fields->search("Will", query_fields, "", facets, sort_fields, 0, 10, 1, FREQUENCY, false).get();ASSERT_EQ(4, results["hits"].size());@@ -574,7 +577,7 @@ TEST_F(CollectionTest, FilterAndQueryFieldRestrictions) {coll_mul_fields = collectionManager.get_collection("coll_mul_fields");if(coll_mul_fields == nullptr) {- coll_mul_fields = collectionManager.create_collection("coll_mul_fields", fields).get();+ coll_mul_fields = collectionManager.create_collection("coll_mul_fields", fields, "points").get();}std::string json_line;@@ -622,7 +625,7 @@ TEST_F(CollectionTest, FilterOnNumericFields) {coll_array_fields = collectionManager.get_collection("coll_array_fields");if(coll_array_fields == nullptr) {- coll_array_fields = collectionManager.create_collection("coll_array_fields", fields).get();+ coll_array_fields = collectionManager.create_collection("coll_array_fields", fields, "age").get();}std::string json_line;@@ -761,7 +764,7 @@ TEST_F(CollectionTest, FilterOnFloatFields) {coll_array_fields = collectionManager.get_collection("coll_array_fields");if(coll_array_fields == nullptr) {- coll_array_fields = collectionManager.create_collection("coll_array_fields", fields).get();+ coll_array_fields = collectionManager.create_collection("coll_array_fields", fields, "age").get();}std::string json_line;@@ -867,7 +870,7 @@ TEST_F(CollectionTest, FilterOnFloatFields) {results = results_op.get();ASSERT_EQ(0, results["hits"].size());- // rank tokens by token ranking field+ // rank tokens by default sorting fieldresults_op = coll_array_fields->search("j", query_fields, "", facets, sort_fields_desc, 0, 10, 1, MAX_SCORE, true).get();ASSERT_TRUE(results_op.ok());results = results_op.get();@@ -899,7 +902,7 @@ TEST_F(CollectionTest, SortOnFloatFields) {coll_float_fields = collectionManager.get_collection("coll_float_fields");if(coll_float_fields == nullptr) {- coll_float_fields = collectionManager.create_collection("coll_float_fields", fields).get();+ coll_float_fields = collectionManager.create_collection("coll_float_fields", fields, "score").get();}std::string json_line;@@ -970,7 +973,7 @@ TEST_F(CollectionTest, QueryBoolFields) {coll_bool = collectionManager.get_collection("coll_bool");if(coll_bool == nullptr) {- coll_bool = collectionManager.create_collection("coll_bool", fields).get();+ coll_bool = collectionManager.create_collection("coll_bool", fields, "rating").get();}std::string json_line;@@ -1057,7 +1060,7 @@ TEST_F(CollectionTest, FilterOnTextFields) {coll_array_fields = collectionManager.get_collection("coll_array_fields");if(coll_array_fields == nullptr) {- coll_array_fields = collectionManager.create_collection("coll_array_fields", fields).get();+ coll_array_fields = collectionManager.create_collection("coll_array_fields", fields, "age").get();}std::string json_line;@@ -1138,7 +1141,7 @@ TEST_F(CollectionTest, HandleBadlyFormedFilterQuery) {coll_array_fields = collectionManager.get_collection("coll_array_fields");if(coll_array_fields == nullptr) {- coll_array_fields = collectionManager.create_collection("coll_array_fields", fields).get();+ coll_array_fields = collectionManager.create_collection("coll_array_fields", fields, "age").get();}std::string json_line;@@ -1194,7 +1197,7 @@ TEST_F(CollectionTest, FacetCounts) {coll_array_fields = collectionManager.get_collection("coll_array_fields");if(coll_array_fields == nullptr) {- coll_array_fields = collectionManager.create_collection("coll_array_fields", fields).get();+ coll_array_fields = collectionManager.create_collection("coll_array_fields", fields, "age").get();}std::string json_line;@@ -1275,7 +1278,7 @@ TEST_F(CollectionTest, SortingOrder) {coll_mul_fields = collectionManager.get_collection("coll_mul_fields");if(coll_mul_fields == nullptr) {- coll_mul_fields = collectionManager.create_collection("coll_mul_fields", fields).get();+ coll_mul_fields = collectionManager.create_collection("coll_mul_fields", fields, "points").get();}std::string json_line;@@ -1363,7 +1366,7 @@ TEST_F(CollectionTest, SearchingWithMissingFields) {coll_array_fields = collectionManager.get_collection("coll_array_fields");if(coll_array_fields == nullptr) {- coll_array_fields = collectionManager.create_collection("coll_array_fields", fields).get();+ coll_array_fields = collectionManager.create_collection("coll_array_fields", fields, "age").get();}std::string json_line;@@ -1454,20 +1457,20 @@ TEST_F(CollectionTest, IndexingWithBadData) {ASSERT_TRUE(empty_facet_field_op.ok());doc_str = "{\"name\": \"foo\", \"age\": \"34\", \"tags\": [], \"average\": 34 }";- const Option<nlohmann::json> & bad_token_ranking_field_op1 = sample_collection->add(doc_str);- ASSERT_FALSE(bad_token_ranking_field_op1.ok());- ASSERT_STREQ("Token ranking field `age` must be a number.", bad_token_ranking_field_op1.error().c_str());+ const Option<nlohmann::json> & bad_default_sorting_field_op1 = sample_collection->add(doc_str);+ ASSERT_FALSE(bad_default_sorting_field_op1.ok());+ ASSERT_STREQ("Default sorting field `age` must be a number.", bad_default_sorting_field_op1.error().c_str());doc_str = "{\"name\": \"foo\", \"age\": 343234324234233234, \"tags\": [], \"average\": 34 }";- const Option<nlohmann::json> & bad_token_ranking_field_op2 = sample_collection->add(doc_str);- ASSERT_FALSE(bad_token_ranking_field_op2.ok());- ASSERT_STREQ("Token ranking field `age` exceeds maximum value of int32.", bad_token_ranking_field_op2.error().c_str());+ const Option<nlohmann::json> & bad_default_sorting_field_op2 = sample_collection->add(doc_str);+ ASSERT_FALSE(bad_default_sorting_field_op2.ok());+ ASSERT_STREQ("Default sorting field `age` exceeds maximum value of an int32.", bad_default_sorting_field_op2.error().c_str());doc_str = "{\"name\": \"foo\", \"tags\": [], \"average\": 34 }";- const Option<nlohmann::json> & bad_token_ranking_field_op3 = sample_collection->add(doc_str);- ASSERT_FALSE(bad_token_ranking_field_op3.ok());- ASSERT_STREQ("Field `age` has been declared as a token ranking field, but is not found in the document.",- bad_token_ranking_field_op3.error().c_str());+ const Option<nlohmann::json> & bad_default_sorting_field_op3 = sample_collection->add(doc_str);+ ASSERT_FALSE(bad_default_sorting_field_op3.ok());+ ASSERT_STREQ("Field `age` has been declared as a default sorting field, but is not found in the document.",+ bad_default_sorting_field_op3.error().c_str());doc_str = "{\"name\": \"foo\", \"age\": 34, \"tags\": [], \"average\": \"34\"}";const Option<nlohmann::json> & bad_rank_field_op = sample_collection->add(doc_str);@@ -1475,9 +1478,9 @@ TEST_F(CollectionTest, IndexingWithBadData) {ASSERT_STREQ("Field `average` must be an int32.", bad_rank_field_op.error().c_str());doc_str = "{\"name\": \"foo\", \"age\": asdadasd, \"tags\": [], \"average\": 34 }";- const Option<nlohmann::json> & bad_token_ranking_field_op4 = sample_collection->add(doc_str);- ASSERT_FALSE(bad_token_ranking_field_op4.ok());- ASSERT_STREQ("Bad JSON.", bad_token_ranking_field_op4.error().c_str());+ const Option<nlohmann::json> & bad_default_sorting_field_op4 = sample_collection->add(doc_str);+ ASSERT_FALSE(bad_default_sorting_field_op4.ok());+ ASSERT_STREQ("Bad JSON.", bad_default_sorting_field_op4.error().c_str());// should return an error when a document with pre-existing id is being addedstd::string doc = "{\"id\": \"100\", \"name\": \"foo\", \"age\": 29, \"tags\": [], \"average\": 78}";@@ -1551,7 +1554,7 @@ TEST_F(CollectionTest, AnIntegerCanBePassedToAFloatField) {coll1 = collectionManager.get_collection("coll1");if(coll1 == nullptr) {- coll1 = collectionManager.create_collection("coll1", fields).get();+ coll1 = collectionManager.create_collection("coll1", fields, "average").get();}nlohmann::json doc;