I'm developing a site that displays results from a local running race from the past 15 years or so.
I have a custom post type called result
with several custom fields.
Each result looks like:
result: { year, position, name, guntime, chiptime, class, classplace}
The results look like this:
I'm pulling in these results via a live-search interface that fetches from wp-json/wp/v2/result?search=SEARCH_TERM
So /wp-json/wp/v2/result?search=colin
gets me all of the Colins in my data.
I have two questions about my setup:
- How do I add a custom field to search on in my query? IE: I want everyone named Colin who ran in 2018. I've read that that the
filter
param was removed before the plugin was merged, so looks like that won't work. I think It used to be as simple asfilter[year]=2018
, but that approach is no longer possible.- I'm wondering more broadly if this whole setup will standup to any real-world traffic. I've got my live-search input debounced, but I'm still going to be doing a ton of api requests. Good news: There is no post content to search through (all the fields are just numerical data). Bad News: I'm still searching about 50,000 post titles looking for matches each time I live-search.
Advice greatly appreciated! Thank you for your time!