diff --git a/src/collection.cpp b/src/collection.cpp index 8ee7527d..8c566db6 100644 --- a/src/collection.cpp +++ b/src/collection.cpp @@ -1909,7 +1909,8 @@ void Collection::process_highlight_fields(const std::vector& sea for(size_t i = 0; i < search_fields.size(); i++) { const auto& field_name = search_fields[i].name; - enable_t field_infix = (i < infixes.size()) ? infixes[search_fields[i].orig_index] : infixes[0]; + enable_t field_infix = (search_fields[i].orig_index < infixes.size()) ? infixes[search_fields[i].orig_index] + : infixes[0]; if(field_infix != off) { fields_infixed_set.insert(field_name); } diff --git a/src/index.cpp b/src/index.cpp index 2481064d..7af92bf7 100644 --- a/src/index.cpp +++ b/src/index.cpp @@ -1922,6 +1922,7 @@ void Index::do_filtering(uint32_t*& filter_ids, uint32_t& filter_ids_length, delete [] result_ids; } + delete [] or_ids; or_ids = excluded_strt_ids; or_ids_size = excluded_strt_size; } @@ -2991,14 +2992,14 @@ void Index::fuzzy_search_fields(const std::vector& the_fields, // NOTE: when accessing other field ordered properties like prefixes or num_typos we have to index // them by `the_field.orig_index` since the original fields could be reordered on their weights. auto& the_field = the_fields[field_id]; - const bool field_prefix = (field_id < prefixes.size()) ? prefixes[the_field.orig_index] : prefixes[0];; + const bool field_prefix = (the_field.orig_index < prefixes.size()) ? prefixes[the_field.orig_index] : prefixes[0];; const bool prefix_search = field_prefix && query_tokens[token_index].is_prefix_searched; const size_t token_len = prefix_search ? (int) token.length() : (int) token.length() + 1; /*LOG(INFO) << "Searching for field: " << the_field.name << ", token:" << token << " - cost: " << costs[token_index] << ", prefix_search: " << prefix_search;*/ - int64_t field_num_typos = (field_id < num_typos.size()) ? num_typos[the_field.orig_index] : num_typos[0]; + int64_t field_num_typos = (the_field.orig_index < num_typos.size()) ? num_typos[the_field.orig_index] : num_typos[0]; auto& locale = search_schema.at(the_field.name).locale; if(locale != "" && locale != "en" && locale != "th" && !Tokenizer::is_cyrillic(locale)) { @@ -3794,7 +3795,8 @@ void Index::do_infix_search(const size_t num_search_fields, const std::vector infix_ids;