Hi guys,
I'm building a site with a database of watches. I have an autocomplete search input. I have fuzzy matching for typing in the watch name (post_title
), but I'd like for the user to be able to enter the watch reference if they have it, this would show just one result if there was an exact match. Is it possible to return just one result if a certain match is found matching the meta.reference.raw
field, and if no match is found for that field fall back to the fuzzy search for the post_title
field?
Example of the data below:
{
"_index": "twptestwp-post-1",
"_type": "_doc",
"_id": "32567",
"_source": {
"post_id": 32567,
"ID": 32567,
"post_title": "ROYAL OAK OFFSHORE DIVER",
"meta": {
"reference": [
{
"value": "15710ST.OO.A010CA.01",
"raw": "15710ST.OO.A010CA.01",
"boolean": false,
"date": "1971-01-01",
"datetime": "1971-01-01 00:00:01",
"time": "00:00:01"
}
]
}
}
}
Many thanks