erquhart
erquhart2y ago

Any news on searching across multiple

Any news on searching across multiple fields?
4 Replies
erquhart
erquhartOP2y ago
Also wondering if there's a workaround to match all when the query is empty. Guessing there's not but thought I'd check. It seems I should use a non-search query when there's no query, and maybe aggregate across a few for searching multiple fields. In this case that means stitching together multiple paginated search queries, not sure if that's advisable. Ah matches require a whole word - I'm searching across fields that typically only have one or two words (transaction data like merchant name). Let me know if you have any ideas on how to do that. I may try to hack local fuzzy search together for this and just filter the paginated results in the client.
Michal Srb
Michal Srb2y ago
There are folks on the team with much more search expertise than me, but one thing that comes to mind is denormalization - you could stitch multiple fields together into a single field, and search that field. You'll have typical denormalization "requirements" - you'll need to update the stitched field every time you mutate any of the source fields. But with Convex and JavaScript this should be pretty easy to do.
ian
ian2y ago
If the corpus is small that you were searching over, you could offer auto complete on the available words. A simple index on a field of just one word will give you the options: To search for a Wa* prefix, you could search Wa <= query < Wb On a table with all the available words. to expand on the comment on denormalization, you could make a search field where you append all of the fields that you want to include in the search rankings. You can even simulate prioritizing certain fields by repeating them more times. When you create / update documents, you recompute the search field. Then the search can find them all. But if it is one or two words, having a table with all known words, and offering those as autocomplete to a user might be the best experience- it lets them know what’s possible. However you’d need to make sure exposing all words makes sense. An example of that is search in Slack will let you pick a user from auto complete, but is less likely to find all messages with a subset of the users name
erquhart
erquhartOP2y ago
Good points, constructing a dedicated target field for search and taking an autocomplete approach are both worth considering. I'm using client side fuzzy search right now, I think that's ultimately the experience and limited complexity I need right now, though I'm loading a lot more data than necessary. Some kind of scored fuzzy search support within Convex would be amazing.

Did you find this page helpful?