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
Geopoint field cannot be a default sorting field.
Kishore Nallan4679d298c72a
diff --git a/include/field.h b/include/field.hindex b0db0a22..da5ae568 100644--- a/include/field.h+++ b/include/field.h@@ -322,6 +322,10 @@ struct field {"` cannot be an optional field.");}+ if(field.is_geopoint()) {+ return Option<bool>(400, "Default sorting field cannot be of type geopoint.");+ }+found_default_sorting_field = true;}diff --git a/test/collection_sorting_test.cpp b/test/collection_sorting_test.cppindex 709f1f54..4de53863 100644--- a/test/collection_sorting_test.cpp+++ b/test/collection_sorting_test.cpp@@ -707,7 +707,35 @@ TEST_F(CollectionSortingTest, GeoPointSorting) {ASSERT_FALSE(res_op.ok());ASSERT_STREQ("Could not find a field named `l` in the schema for sorting.", res_op.error().c_str());+ // should not allow creation of collection with geo field as default_sorting_field+ nlohmann::json schema = R"({+ "name": "coll_geo",+ "fields": [+ {"name": "title", "type": "string"},+ {"name": "location", "type": "geopoint" }+ ],+ "default_sorting_field": "location"+ })"_json;++ auto op = collectionManager.create_collection(schema);+ ASSERT_FALSE(op.ok());+ ASSERT_EQ("Default sorting field cannot be of type geopoint.", op.error());++ schema = R"({+ "name": "coll_geo",+ "fields": [+ {"name": "title", "type": "string"},+ {"name": "location", "type": "geopoint[]" }+ ],+ "default_sorting_field": "location"+ })"_json;++ op = collectionManager.create_collection(schema);+ ASSERT_FALSE(op.ok());+ ASSERT_EQ("Default sorting field cannot be of type geopoint.", op.error());+collectionManager.drop_collection("coll1");+ collectionManager.drop_collection("coll_geo");}TEST_F(CollectionSortingTest, GeoPointSortingWithExcludeRadius) {