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

Remove `SEQ_IDS_FILTER` logic.

Harpreet Sangarfdd643b563d0
diff --git a/include/index.h b/include/index.h
index 45ce8172..3a511ba0 100644
--- a/include/index.h
+++ b/include/index.h
@@ -540,10 +540,6 @@ public:
// in the query that have the least individual hits one by one until enough results are found.
static const int DROP_TOKENS_THRESHOLD = 1;
- // "_all_" is a special field that maps to all the ids in the index.
- static constexpr const char* SEQ_IDS_FIELD = "_all_";
- static constexpr const char* SEQ_IDS_FILTER = "_all_: 1";
-
Index() = delete;
Index(const std::string& name,
diff --git a/src/filter.cpp b/src/filter.cpp
index 18348ed6..95fbfefc 100644
--- a/src/filter.cpp
+++ b/src/filter.cpp
@@ -283,9 +283,6 @@ Option<bool> toFilter(const std::string expression,
}
}
return Option<bool>(true);
- } else if (field_name == Index::SEQ_IDS_FIELD) {
- filter_exp = {field_name, {}, {}};
- return Option<bool>(true);
}
auto field_it = search_schema.find(field_name);
diff --git a/src/filter_result_iterator.cpp b/src/filter_result_iterator.cpp
index c4dcd0b5..88485aa4 100644
--- a/src/filter_result_iterator.cpp
+++ b/src/filter_result_iterator.cpp
@@ -588,18 +588,6 @@ void filter_result_iterator_t::init() {
filter_result.docs = new uint32_t[result_ids.size()];
std::copy(result_ids.begin(), result_ids.end(), filter_result.docs);
- seq_id = filter_result.docs[result_index];
- is_filter_result_initialized = true;
- return;
- } else if (a_filter.field_name == Index::SEQ_IDS_FIELD) {
- if (index->seq_ids->num_ids() == 0) {
- is_valid = false;
- return;
- }
-
- approx_filter_ids_length = filter_result.count = index->seq_ids->num_ids();
- filter_result.docs = index->seq_ids->uncompress();
-
seq_id = filter_result.docs[result_index];
is_filter_result_initialized = true;
return;
diff --git a/src/index.cpp b/src/index.cpp
index 207c44bb..e8634a3b 100644
--- a/src/index.cpp
+++ b/src/index.cpp
@@ -2389,11 +2389,7 @@ Option<bool> Index::search(std::vector<query_tokens_t>& field_query_tokens, cons
// if filters were not provided, use the seq_ids index to generate the list of all document ids
if (no_filters_provided) {
- const std::string doc_id_prefix = std::to_string(collection_id) + "_" + Collection::DOC_ID_PREFIX + "_";
- Option<bool> parse_filter_op = filter::parse_filter_query(SEQ_IDS_FILTER, search_schema,
- store, doc_id_prefix, filter_tree_root);
-
- filter_result_iterator = new filter_result_iterator_t(collection_name, this, filter_tree_root);
+ filter_result_iterator = new filter_result_iterator_t(seq_ids->uncompress(), seq_ids->num_ids());
filter_iterator_guard.reset(filter_result_iterator);
approx_filter_ids_length = filter_result_iterator->approx_filter_ids_length;
@@ -2514,13 +2510,6 @@ Option<bool> Index::search(std::vector<query_tokens_t>& field_query_tokens, cons
filter_result_iterator->reset();
}
- // filter tree was initialized to have all sequence ids in this flow.
- if (no_filters_provided) {
- delete filter_tree_root;
- filter_tree_root = nullptr;
- approx_filter_ids_length = 0;
- }
-
uint32_t _all_result_ids_len = all_result_ids_len;
curate_filtered_ids(curated_ids, excluded_result_ids,
excluded_result_ids_size, all_result_ids, _all_result_ids_len, curated_ids_sorted);