Hi Yext team,
We have a client who would like to search on two different fields in a single locator search bar. The first field is the standard location field (same as in the hitchhiker training). And the second field is a text list of zip codes (ex: 22207, 20152, 22209). The filter search bar generates autocomplete options for both fields, so typing in “22207” will surface two autocomplete results “Arlington, Virginia 22207” and “22207”. The first result will trigger a location search, and the second will trigger a search on the text list zip code field. Is there a way to have the zip code search “22207” also do a location search (or vice versa)? The client would like a single search to look in both fields.
We are currently using the FilterSearch component and passing in this for the searchfields parameter:
{ entityType: “financialProfessional”, fieldApiName: “builtin.location”, }, { entityType: “financialProfessional”, fieldApiName: “c_zipCodes”, }
And when an autocomplete option is selected, we have a function passed in to the onSelect parameter which creates this filter and does a vertical search:
filter: { kind: “fieldValue”, fieldId: params.newFilter.fieldId, value: params.newFilter.value, matcher: Matcher.Equals, }
I tried submitting the search value to both fields (22207 → c_zipcodes and 22207 → builtin.location), but it only showed results for searching on the text list zipcodes field. If there is any way to search both fields at once let me know!
Hey Holden,
What is the business purpose for searching on two different location fields? Searching for a zipcode on builtin.location should return desired results.
When a field value is selected in Filter Search, a static filter is being applied with that value. What’s most likely happening is that the zipcode static filter is filtering the list to be only the ones in that zipcode, and is thus working as intended. Are you seeing something different?
Best,
Daniel
The client is not asking to search on two different location fields. The zipcode field being searched on is a text list. The zipcode static filter does work for searching on that field, but the client wants to search both the location field and the text list field at the same time
Wanted to bump this Baigel since the customer is concerned with the functionality occuring
Hey Michael and Holden,
I’m still not sure I understand the business purpose for searching on both a zipcode and builtin.location
fields? Is the expected functionality that if you select a zipcode from the list that you would run a search with two static filters applied? One for the zipcode and one for builtin.location
?
If this is the case I don’t think the result set would be significantly different than what it is now. The builtin.location
geo search applies a point and radius filter on the search results. A static filter on a zipcode text list will only show results in that zipcode. Both filters are doing pretty similar things, just the zipcode one is more restrictive than the other. When you have two static filters on a single query, they are ANDed together, meaning only results that appear in both filters will return.
What if you select a zipcode from the builtin.location
dropdown that doesn’t exist in the zipcode list? If we were to use the logic as described above, no results would appear since there are no locations in the requested zipcode. Is that the desired functionality?