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
Increase default candidates for smaller collections.
Kishore Nallan64def55527f7
diff --git a/include/index.h b/include/index.hindex 5e061edc..95a8a4ff 100644--- a/include/index.h+++ b/include/index.h@@ -540,7 +540,9 @@ public:enum {COMBINATION_MAX_LIMIT = 10000};enum {COMBINATION_MIN_LIMIT = 10};- enum {MAX_CANDIDATES_DEFAULT = 4};++ enum {NUM_CANDIDATES_DEFAULT_MIN = 4};+ enum {NUM_CANDIDATES_DEFAULT_MAX = 10};// If the number of results found is less than this threshold, Typesense will attempt to drop the tokens// in the query that have the least individual hits one by one until enough results are found.diff --git a/src/collection_manager.cpp b/src/collection_manager.cppindex 0492fb11..a27f46bd 100644--- a/src/collection_manager.cpp+++ b/src/collection_manager.cpp@@ -918,7 +918,9 @@ Option<bool> CollectionManager::do_search(std::map<std::string, std::string>& re}if(!max_candidates) {- max_candidates = exhaustive_search ? Index::COMBINATION_MAX_LIMIT : Index::MAX_CANDIDATES_DEFAULT;+ max_candidates = exhaustive_search ? Index::COMBINATION_MAX_LIMIT :+ (collection->get_num_documents() < 500000 ? Index::NUM_CANDIDATES_DEFAULT_MAX :+ Index::NUM_CANDIDATES_DEFAULT_MIN);}Option<nlohmann::json> result_op = collection->search(raw_query, search_fields, simple_filter_query, facet_fields,