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.
Link:
https://preview.webflow.com/preview/search-029e2c?utm_medium=preview_link&utm_source=designer&utm_content=search-029e2c&preview=4910cfee3ee81381524f50ea559c53b6&workflow=preview

Lets’s say I have a collection.

1 {
a: x
b: y
},

2{
a: x
b:
}

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.