Google Maps Places Autocomplete search any position - javascript

When I use google places autocomplete api and as search places with keyword
&input=MyWord
result is places that start with MyWord. e.g. MyWord1 , MyWord2, MyWordblalba
I want to get results that contain MyWord in middle or at any position of result. e.g. blablaMyWordbla
Is it possible ? I can't find any parameter or wildcard in documentation
https://developers.google.com/maps/documentation/javascript/places-autocomplete

As far as I know there is not such functionality to search locations by wildcards, you can only search by beginning of the word

I suggest using the Search functionality of the API, rather than Autocomplete. Autocomplete is designed to complete place names typed by an end-user and therefore focuses on generating suggestions for suffixes.

Related

JavaScript package to create a search bar like Kibana

Does anyone know a JavaScript package that allows to create a multi-keyword filter query like for example the searchbar of Kibana. StackOverflow, Trello and Gitlab have similar capabilities, but not all have support for multiple filters at once or don't have autocomplete for all possible search filters.
I am looking for something similar to select2 with tags, but then the predefined options are all the available filters and after selecting a filter you can enter the desired value. For instance, you enter "user:" after which you can select one of your users. This will then result in "user:John" in your search bar (and underneath it keeps track of the user id for the actual search). Next you can add another filter etc. resulting in powerfull search queries while using just one search box.
Also see this Kibana search example:
I am just wondering what already exists, before I start making this.

How to use a search bar on site to search sub urls

I need to find out how to have a search bar that can find other pages on my site. Doing a google search, I can only find the code to create a search bar, and not utilise it. Its features would need to include auto correct and actually going to the page, basically these 2 things combined (https://www.w3schools.com/howto/howto_js_autocomplete.asp and https://www.w3schools.com/howto/howto_js_filter_lists.asp)
In the how to filter/search list example you can just add the urls to the corresponding links like <li>Adele</li>.
And in the how to js autocomplete example it will be a bit different and additional code needs to be written. If the url is the same as the items in the list there would not be an issue, but otherwise you need to make the array of countries into an array of objects so that each object will have the name of the country and the corresponding url. Then in the javascript function you will have to access the components as arr[x].country.
The array of countries should look something like this
`var countries = [{country:"Afghanistan", url:"afghanistan"}, {country:"Albania", url:"albania"},...}.
Then add an onClick event handler in the javascript function.
onClick="location.href=`www.example.com/${arr[x].url}`"
You can use Tipue search for that. It's easy and has many options. Like related links, search description, pagination.
It's very easy to customize, if you know how to use inspect element or javascript.
http://www.tipue.com/search/

How to add my own custom places at autocomplete Places search box?

I have implemented autocomplete search box. From here,
Places search box
I have seen this question, how-to-display-custom-places-in-google-maps-api-search-results
But it was unable to help me. The accepted answer is not showing custom places in auto completed result.
Now I want to show also my own custom places (from a JSON list of places) along with Google's place suggestion at autocomplete result. How can I implement this?

Google Search Map

Something has crossed my mind recently and I can't seem to really find an answer .. I have tried few times and without success.
How do you get a google search box with places and locations without having the map on the same page.
You basically choose the place , then press search and it redirects to a map.
The part where I am stuck is that I just want the google search box from here , without the map ? Any ideas ?
https://developers.google.com/maps/documentation/javascript/examples/places-searchbox
Here is another example :
To resume : Is it possible to have just the search box ? Then click a button and redirect to another page with the map.
I haven't used it without the map, but I think you need to al least bound the SearchBox to an input and and then how you handle results is up to you, including redirecting to a different page.

Google Maps API - Search XML Markers

EDIT: Just some background information - the system is set up using mySQL to store each marker's info, which is then converted into an XML file by some PHP code, which then displays it via the Maps javascript file. I currently have about 10 markers, which are stored in the mySQL database. Upon loading the map, all the markers are loaded.
I am currently using the Maps API v3 to display markers, and to display their infoWindows in a div. That's all good so far.
What I'd like to do it add a search functionality.
From what I understand, the API does have a search function, but when I tried it on the example in the documentation, it did a search across the whole map. I want it to only search amongst my markers.
EDIT: As I mentioned in the EDIT at the top, all markers are displayed at the initialize() - therefore, when someone searches for a location, the closest match would be selected. In the case of my map, the infowindow is displayed and split across 2 'html' sections, outside the map area (i.e., there is no bubble display on the actual map)
EDIT: Initially, I was worried that someone would come along and copy my idea if I posted the URL, but I'm sure it's been done already! Scr*w it - CityMap Prototype
So, I guess I'd need to find/create some sort of system that searches the XML file. Initially, the user would only be able to search for locations by name. Later, I'm sure I could come up with creative uses for the search.
Can anyone point me in the right direction?
EDIT:
After posting this, I found a tutorial on W3C - PHP Example - AJAX Live Search. It searches for links from an XML file, and then displays them in the temporary search results under the bar, as you type. Does anyone know how I can link this search function to the markers?
From what I can understand, I'd need to somehow link to each marker via XML, but that's the extent to my guess.
Thanks
From my understanding the api's search functionality is not for local files but for the whole map(world), if you are doing php I would recommend for the time being utilizing the tutorial you found and then linking the search functionality to performing some sort of javacript response which would perform the action which you are looking for upon search. I am not sure what this functionality is as you already would have the markers plotted on the map from the sound of your question. Let me know if you need more on this not sure if you are in a php/ruby/asp environment. (or if you are in a truly html environment) hth

Categories