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
Fix sorting - should be in ascending order.
Kishore Nallan0f756efe74f8
diff --git a/include/topster.h b/include/topster.hindex 48c35f22..62a22d03 100644--- a/include/topster.h+++ b/include/topster.h@@ -3,6 +3,7 @@#include <cstdint>#include <climits>#include <cstdio>+#include <algorithm>template <size_t MAX_SIZE=100>struct Topster {@@ -84,14 +85,21 @@ struct Topster {unpack(i, ikey, ival);unpack(j, jkey, jval);- return ival < jval;+ return jval < ival;}void sort() {- std::stable_sort(std::begin(data), std::end(data), compare_values);+ std::stable_sort(std::begin(data), std::begin(data)+size, compare_values);}void clear(){size = 0;}++ uint32_t getKeyAt(uint32_t& index) {+ uint32_t key;+ uint32_t value;+ unpack(data[index], key, value);+ return key;+ }};\ No newline at end of file