mirror of
https://github.com/typesense/typesense.git
synced 2025-05-22 06:40:30 +08:00
Remove SEQ_IDS_FILTER
logic.
This commit is contained in:
parent
1520be463b
commit
fdd643b563
@ -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,
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user