Skip to content

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

Merge branch 'v0.25-join' into v0.26-facets

Kishore Nallande0471634970
diff --cc include/collection.h
index 95c4b235,f95b7c9f..692e4142
--- a/include/collection.h
+++ b/include/collection.h
@@@ -473,11 -466,8 +473,11 @@@ public
const size_t facet_sample_percent = 100,
const size_t facet_sample_threshold = 0,
const size_t page_offset = 0,
+ facet_index_type_t facet_index_type = HASH,
const size_t remote_embedding_timeout_ms = 30000,
- const size_t remote_embedding_num_try = 2,
- const size_t remote_embedding_num_tries = 2) const;
++ const size_t remote_embedding_num_tries = 2,
+ const std::string& stopwords_set="",
+ const std::vector<std::string>& facet_return_parent = {}) const;
Option<bool> get_filter_ids(const std::string & filter_query, filter_result_t& filter_result) const;
diff --cc src/collection.cpp
index f7b8eea1,e60ffe41..41b3f926
--- a/src/collection.cpp
+++ b/src/collection.cpp
@@@ -1120,11 -1119,8 +1120,11 @@@ Option<nlohmann::json> Collection::sear
const size_t facet_sample_percent,
const size_t facet_sample_threshold,
const size_t page_offset,
+ facet_index_type_t facet_index_type,
const size_t remote_embedding_timeout_ms,
- const size_t remote_embedding_num_try,
- const size_t remote_embedding_num_tries) const {
++ const size_t remote_embedding_num_tries,
+ const std::string& stopwords_set,
+ const std::vector<std::string>& facet_return_parent) const {
std::shared_lock lock(mutex);
diff --cc src/collection_manager.cpp
index 58eac68c,3610eeb5..20e004ed
--- a/src/collection_manager.cpp
+++ b/src/collection_manager.cpp
@@@ -1220,11 -1093,8 +1220,11 @@@ Option<bool> CollectionManager::do_sear
facet_sample_percent,
facet_sample_threshold,
offset,
+ HASH,
remote_embedding_timeout_ms,
- remote_embedding_num_try,
- remote_embedding_num_tries
++ remote_embedding_num_tries,
+ stopwords_set,
+ facet_return_parent
);
uint64_t timeMillis = std::chrono::duration_cast<std::chrono::milliseconds>(
diff --cc src/index.cpp
index add2c363,7192faba..ee4021a9
--- a/src/index.cpp
+++ b/src/index.cpp
@@@ -2742,20 -3204,19 +2742,18 @@@ Option<bool> Index::search(std::vector<
auto result = result_it->second;
// old_score + (1 / rank_of_document) * WEIGHT)
result->vector_distance = vec_result.second;
- result->scores[result->match_score_index] = float_to_int64_t(
+ int64_t match_score = float_to_int64_t(
(int64_t_to_float(result->scores[result->match_score_index])) +
((1.0 / (res_index + 1)) * VECTOR_SEARCH_WEIGHT));
+ int64_t match_score_index = -1;
+ int64_t scores[3] = {0};
+
+ compute_sort_scores(sort_fields_std, sort_order, field_values, geopoint_indices, doc_id, 0, match_score, scores, match_score_index, vec_result.second);
- for(size_t i = 0;i < 3; i++) {
- if(field_values[i] == &vector_distance_sentinel_value) {
- result->scores[i] = float_to_int64_t(vec_result.second);
- }
-
- if(sort_order[i] == -1) {
- result->scores[i] = -result->scores[i];
- }
+ for(int i = 0; i < 3; i++) {
+ result->scores[i] = scores[i];
}
-
+ result->match_score_index = match_score_index;
-
} else {
// Result has been found only in vector search: we have to add it to both KV and result_ids
// (1 / rank_of_document) * WEIGHT)