valeriansaliou / sonic

๐Ÿฆ” Fast, lightweight & schema-less search backend. An alternative to Elasticsearch that runs on a few MBs of RAM.

Home Page:https://crates.io/crates/sonic-server

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Buckets VS Collections (in regard to suggestion)

janniks opened this issue ยท comments

I have a question on how suggestion gathers its terms:

For example, if we only have one type of data (e.g. documents). We might assume that we don't need multiple different collections. But can rather group users by collections and just always keep a static bucket name (e.g. default).

i.e.
Documents for Alice (id 123) in <user-123> <default>
Documents for Bob (id 456) in <user-456> <default>

Is this safe?

I ask, because I'm not sure how suggestion works. Does it aggregate suggestible terms from a bucket or from a collection (or both together)?

e.g.
If Alice asks for a suggestion and terms are included from all default buckets, it might suggest private terms that only Bob should be able to see.

๐Ÿ™ Thanks for the help, I hope it's clear what I'm trying to say ๐Ÿ˜„

Suggestions are namespaced by (collection, bucket) tuple, so both together.

Note that the collection is not supposed to be set to an user ID or something that has a huge cardinality. A collection should be something like "messages", "documents", "movies", etc... and a bucket could be namespaced by user yeah.

Thanks for the fast response and clarification!
That helps a lot ๐Ÿ˜Š