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
Update error response.
Harpreet Sangar4985c941c6c6
diff --git a/src/filter_result_iterator.cpp b/src/filter_result_iterator.cppindex 40c2f936..ba776090 100644--- a/src/filter_result_iterator.cpp+++ b/src/filter_result_iterator.cpp@@ -901,9 +901,12 @@ void filter_result_iterator_t::init() {S2Error error;if (loop->FindValidationError(&error)) {- status = Option<bool>(400, "Polygon (" + filter_value + ") is invalid: " + error.text());delete loop;- break;+ status = Option<bool>(400, "Polygon" + (a_filter.values.size() > 1 ?+ " at position " + std::to_string(fi + 1) : "")+ + " is invalid: " + error.text());+ is_valid = false;+ return;} else {query_region = loop;}diff --git a/test/collection_sorting_test.cpp b/test/collection_sorting_test.cppindex abbea30c..e7b354b9 100644--- a/test/collection_sorting_test.cpp+++ b/test/collection_sorting_test.cpp@@ -842,8 +842,7 @@ TEST_F(CollectionSortingTest, GeoPointSortingWithExcludeRadius) {"77.10249019999999, 28.7040592, 77.10249019999999, 28.7040592, 77.10249019999999)",{}, geo_sort_fields, {0}, 10, 1, FREQUENCY);ASSERT_FALSE(res_op.ok());- ASSERT_EQ("Polygon (28.7040592, 77.10249019999999, 28.7040592, 77.10249019999999, 28.7040592, 77.10249019999999,"- " 28.7040592, 77.10249019999999) is invalid: Edge 0 is degenerate (duplicate vertex)", res_op.error());+ ASSERT_EQ("Polygon is invalid: Edge 0 is degenerate (duplicate vertex)", res_op.error());// badly formatted exclusion filterdiff --git a/test/geo_filtering_old_test.cpp b/test/geo_filtering_old_test.cppindex 61e61b42..d9754a21 100644--- a/test/geo_filtering_old_test.cpp+++ b/test/geo_filtering_old_test.cpp@@ -444,14 +444,12 @@ TEST_F(GeoFilteringOldTest, GeoPolygonFiltering) {auto search_op = coll1->search("*", {}, "loc: (10, 20, 11, 12, 14, 16, 10, 20, 11, 40)", {}, {}, {0}, 10, 1,FREQUENCY);ASSERT_FALSE(search_op.ok());- ASSERT_EQ("Polygon (10, 20, 11, 12, 14, 16, 10, 20, 11, 40) is invalid: Edge 2 has duplicate vertex with edge 4",- search_op.error());+ ASSERT_EQ("Polygon is invalid: Edge 2 has duplicate vertex with edge 4", search_op.error());search_op = coll1->search("*", {}, "loc: (10, 20, 11, 12, 14, 16, 10, 20)", {}, {}, {0}, 10, 1,FREQUENCY);ASSERT_FALSE(search_op.ok());- ASSERT_EQ("Polygon (10, 20, 11, 12, 14, 16, 10, 20) is invalid: Edge 3 is degenerate (duplicate vertex)",- search_op.error());+ ASSERT_EQ("Polygon is invalid: Edge 3 is degenerate (duplicate vertex)", search_op.error());collectionManager.drop_collection("coll1");}diff --git a/test/geo_filtering_test.cpp b/test/geo_filtering_test.cppindex fbb498cb..81342b55 100644--- a/test/geo_filtering_test.cpp+++ b/test/geo_filtering_test.cpp@@ -480,14 +480,17 @@ TEST_F(GeoFilteringTest, GeoPolygonFiltering) {auto search_op = coll1->search("*", {}, "loc: (10, 20, 11, 12, 14, 16, 10, 20, 11, 40)", {}, {}, {0}, 10, 1,FREQUENCY);ASSERT_FALSE(search_op.ok());- ASSERT_EQ("Polygon (10, 20, 11, 12, 14, 16, 10, 20, 11, 40) is invalid: Edge 2 has duplicate vertex with edge 4",- search_op.error());+ ASSERT_EQ("Polygon is invalid: Edge 2 has duplicate vertex with edge 4", search_op.error());search_op = coll1->search("*", {}, "loc: (10, 20, 11, 12, 14, 16, 10, 20)", {}, {}, {0}, 10, 1,FREQUENCY);ASSERT_FALSE(search_op.ok());- ASSERT_EQ("Polygon (10, 20, 11, 12, 14, 16, 10, 20) is invalid: Edge 3 is degenerate (duplicate vertex)",- search_op.error());+ ASSERT_EQ("Polygon is invalid: Edge 3 is degenerate (duplicate vertex)", search_op.error());++ search_op = coll1->search("*", {}, "loc: [([10, 20, 30, 40, 50, 30]), ([10, 20, 11, 12, 14, 16, 10, 20])]", {}, {},+ {0}, 10, 1, FREQUENCY);+ ASSERT_FALSE(search_op.ok());+ ASSERT_EQ("Polygon at position 2 is invalid: Edge 3 is degenerate (duplicate vertex)", search_op.error());collectionManager.drop_collection("coll1");}