MeiliSearch/meilisearch-core/src
bors[bot] f564a9ce51
Merge #849
849: Update nbHits count with filtered documents r=MarinPostma a=balajisivaraman

Closes #764 
close #1039

After discussing with @MarinPostma on Slack, this is my first attempt at implementing this for the basic flow that will go through `bucket_sort_with_distinct`.

A few thoughts here: 

- For getting the count of filtered documents alone, I originally thought of using `filter_map.values().filter(|&&v| !v).count()`. In a few cases, this was the same as what I have now implemented. But I realised I couldn't do something similar for `distinct`. So for being consistent, I have implemented both in a similar fashion.
- I also needed the `contains_key` check to ensure we're not counting the same document ID twice.

@MarinPostma also mentioned that this will be an approximation since the sort is lazy. In the test example that I've updated, the actual filtered count will be just 19 (for `male` records), but due to the `limit` in play, it returns 32 (filtering out 11 records overall).

Please let me know if this is the kind of fix we are looking for, and I can implement it in the placeholder search also.

Co-authored-by: Balaji Sivaraman <balaji@balajisivaraman.com>
2020-11-26 09:53:13 +00:00
..
automaton Reintroduce the distinct search system 2020-01-16 15:55:55 +01:00
criterion make clippy happy 2 2020-06-30 11:01:07 +02:00
filters make clippy happy 1 2020-06-30 11:01:07 +02:00
serde Revert "Merge #1001" 2020-11-02 15:10:09 +01:00
store Revert "Merge #1001" 2020-11-02 15:10:09 +01:00
update fix clear document bug 2020-11-19 14:04:07 +01:00
bucket_sort.rs feat(search): update nbHits count with filtered docs for core flow 2020-11-19 19:35:37 +05:30
database.rs remove useless function after health route refacto #1026 2020-10-20 16:21:46 +02:00
distinct_map.rs Rename MeiliDB into MeiliSearch 2019-11-26 11:12:30 +01:00
error.rs Update error.rs 2020-07-20 14:42:47 +02:00
facets.rs Revert "Merge #1001" 2020-11-02 15:10:09 +01:00
levenshtein.rs Rename MeiliDB into MeiliSearch 2019-11-26 11:12:30 +01:00
lib.rs make clippy happy 2 2020-06-30 11:01:07 +02:00
number.rs make clippy happy 1 2020-06-30 11:01:07 +02:00
query_builder.rs feat(search): update nbHits count with filtered docs for placeholder search 2020-11-19 21:02:47 +05:30
query_tree.rs refactor errors / isolate core/http errors 2020-05-28 16:23:46 +02:00
query_words_mapper.rs make clippy happy 2 2020-06-30 11:01:07 +02:00
ranked_map.rs fix for review 2020-02-11 15:28:00 +01:00
raw_document.rs Reintroduce a basic highlight display 2020-01-16 14:24:45 +01:00
raw_indexer.rs add test document over 1000 words 2020-06-30 18:49:33 +02:00
reordered_attrs.rs Reintroduce searchable attributes and reordering 2019-12-13 14:38:25 +01:00
settings.rs changed the implementation of displayedAttributes from HashSet into BtreeSet 2020-09-02 11:13:16 +09:00