Hey there, I am considering to use "curation" for ...
# community-help
s
Hey there, I am considering to use "curation" for the following use case: I would like to implement "similar products". My idea is: I pre-calculate everything on the server and then use typesense to let the user to filter further. I am looking for something that would allow me to define "pre-defined" result sets that I could query by some id or something. I was wondering if I could use curation for that. I would save the pre-calculated id as "includes" in a curation and then use some md5 hash or what not as the trigger. Would this work for 50k+ products or could I shoot myself in the foot w.r.t perfomance? https://typesense.org/docs/0.23.0/api/curation.html
k
For every product, are you going to have a list of similar products pre calculated?
s
yes
k
Then you can just have another collection for this right? Need not use curation at all.
s
True but wouldn't that use a lot of extra memory?
An alias with pre-defined filters would work
but I think that's not supported
k
Thinking through the options, one second
@Stefan Hesse In 0.23, we actually have an undocumented API (which we plan to announce in the next version) called preset API, which will be perfect for this. Using the preset API you can pre-configure a search query using an identifier and then refer to it during search time. For e.g. you can have 1 preset query for each of your 50K products. See this example: https://gist.github.com/kishorenc/da9431b8be0d104f79cb03b4fde970cf
👀 2
s
That looks pretty much perfect! Is it stableish?
k
Yes, it's stable. We wanted to implement one minor feature addition before unveiling it.
s
Okay, cool. I will use that. Thank you!
👍 1
Hey, so there is actually one more requirement which doesn't seem to be possible using just result-sets and that is: I have to sort those documents by a value that is not stored in typesense (because it depends on the target product). I think that isn't possible
k
Can that be done client side?
s
Probably not there can be up to 2k candidates
k
2K related items per product?
s
yes
k
Not possible to store that within Typesense?
s
that would be 50k products
so 50k * 2k related items
the most reasonable solution would be 50k colletctions, but that seems wrong
k
Can't you store the doc IDs already in pre sorted form?
Wait actually that won't work because even if the filter list is in a specific order, results won't be in that order.
s
That would have been a nice work around
k
It feels like we need a feature to allow results to be sorted by the same order as the IDs in filter_by clause.
s
that would certainly fix my usecase