Search function results from CMS collection only

Hi Altruist,
I wanted a search functionality in my Webflow project. For that, I would use two text input fields. One of the fields would be required and another one would be optional.

Lets’s say I have a collection.

1 {
a: x
b: y

a: x

So if anyone inserts a value (in this case ‘x’) for a, and leaves blank b, then the result would show only 2. What is the best solution for that?

Thank you.

It can be done, but it requires a fair bit of script, since you need to de-paginate the collection list, and then filter the entire contents to your record set.

Also “name” is probably not a useful key, most users will enter it differently at different times… first name, last name, full name, first initial…

Using the CMS and collection lists for this purpose is probably not the right way to go, these are designed for publishing, not as a general purpose db. Have a look at using airtable or even google sheets as your datastore.

You can use script and automation like Make or n8n to query that datasource and return the results to your Webflow page.