mwargerM
Convex Community2y ago
5 replies
mwarger

How to filter based on a field while also using search index?

How can I narrow a table on a certain field and then also search based on a field?

For example, say I have a registrations table where each one will belong to a different organization and each has
name
. How can I effectively query based on an index for organization and then also filter them based on a search parameter for
name
? It doesn't appear we can use an index and a searchIndex at the same time.

I've considered just doing a regular index on organization and then doing a filter on
name
, but I might have to do some sort of fuzzy lookup manually. I also thought of using a search index on the
name
field and then filtering on the organization. I'm not sure what pattern to adopt here.

Any advice on how to structure this effectively? I'm going to try and call paginate on the resulting list and showing these results in a table .

Thank you.
Was this page helpful?