I’m facing a problem. I search a solution on the internet but didn’t find any solution.
Here is my problem :
I have some items stored in a DB table with a location (lat and long). For example a aircraft in Paris, a bike in new york, another bike in paris, a dishwasher in Tokyo etc…
I would like to find all the item of a type near a place.
For that, I did 2 input fields : One called “What” and another called “Where” (this one has autocompletion of google maps). If you entered “Bike” in the first field and “Paris” in the second, it works perfectly ! (I use geocode to get the coordinates of the “Where” field” and then use a SQL query to filter the object type)
But my goal is to achieve this in one input field ! A global field where the user can enter “Bike Paris” or “Paris Bike” and get the result of all bike near paris that are in the DB. As it is the case in google maps : if you type “mobile phone chicago”: it will interpret “mobile phone near chicago” and get your results. The difficulty is to interpret which word i a place and which one is not.
Do you have a idea of how to achieve this ?
Thank you in advance.
This need some work. One way to do it is to use some means of certain machine learning classification algorithms. What they basically does is that they are trained using certain kind of dataset containing observations to classify objects into certain classes. So when they are given a new object they can classify it accordingly.
You can read more about them here and here
If you can’t manage that sort of complexity one simple thing you could do is search both the words the user enters in the smallest dataset(ie, things or place) if one of them is very large than the other, etc.