Since the Wordpress plugin that facilitates this functionality has been deprecated i have decided to leverage the places API https://community.algolia.com/places/examples.html#searching-in-a-country which is not as precise as the search API but began tweaking to see if it will be an easier workaround/alternative to autocompleting some suburbs and regions in my search form.
Something I would like to test on my demo page before making a final decision. The idea is to try to bind the places autosuggest API with my search input field so it will query based on an input event with search terms location (region, suburb) . This could happen upon click > search and/or enter event ? which ever one is convenient for the user…
At this juncture when i enter for instance “accra” which auto suggests “Greater Accra Region” refer to screenshot
I get returned 21 (wrong) results instead of 6 (correct) which is what we have populated in the wordpress DB for properties in “Greater Accra Region”
We are supposed to be getting this http://demo.url.com/properties/?realteo_order=featured&keyword_search=&_property_type=buy&_offer_type=&tax-region=greater-accra-region&_bedrooms=&_bathrooms=&_area_min=0&_area_max=1000&_price_min=1&_price_max=5564045 which is the correct redirected url
Any tips on the best approach or code samples? My idea is to parse a string upon element select via an autosuggest API called Algolia which should expect a string to point to a URL resource that will return data (json or?) via a wordpress url resource (ajax or?). The Algolia API might not filter the results, instead a query string will be returned for the respective term field, which our server-side script should use for filtering the search results. For example, if the data source option is set to "http://demo.url.com/properties/" and the user types Accra, a GET request would be made to http://demo.url.com/properties/?term=Accra or something which will reflect the correct results on search results page.