diff --git a/components/Forms/BookingWidget/FormContent/Search/reducer.ts b/components/Forms/BookingWidget/FormContent/Search/reducer.ts index 4c42a2507..dd7bb1f8c 100644 --- a/components/Forms/BookingWidget/FormContent/Search/reducer.ts +++ b/components/Forms/BookingWidget/FormContent/Search/reducer.ts @@ -41,11 +41,13 @@ export function reducer(state: State, action: Action) { const search = action.payload.search.toLowerCase() state.defaultLocations.forEach((location) => { const locationName = location.name.toLowerCase() - const keyWords = location.keyWords?.map((l) => l.toLowerCase()) + const keyWords = location.keyWords?.flatMap((l) => + l.toLowerCase().split(" ") + ) if (locationName.includes(search.trim())) { matchesMap.set(location.name, location) } - if (keyWords?.find((keyWord) => keyWord.includes(search.trim()))) { + if (keyWords?.find((keyWord) => keyWord.startsWith(search.trim()))) { matchesMap.set(location.name, location) } })