meilisearch/meilisearch-http
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
..
public URL encode search in web UI 2020-10-05 11:57:52 -07:00
src remove maintenance error from http 2020-11-16 17:30:37 +01:00
tests Merge #849 2020-11-26 09:53:13 +00:00
build.rs Rename MeiliDB into MeiliSearch 2019-11-26 11:12:30 +01:00
Cargo.toml Bump futures from 0.3.6 to 0.3.7 2020-11-03 08:39:09 +00:00