Search With Autocomplete

Hello, i’m actually trying to implement search with autocomplete api. But i guess i am missing some point or how to achieve desired result.
https://api.tomtom.com/search/2/autocomplete/pizza.json?key={API KEY}&language=en-US
using this api. Lets say i want to acheive result against some post code lets say " SE4 1BQ "
I am trying to put this in " query " but not getting the result.
I have searched out for results on maps sdk example. How can achieve results in my address api.
Thanks in advance.

Hi!
The Autocomplete service only offers suggestions for brands and categories. I assume you are looking for “instant search” behavior: getting (all) search results while you type. This is available as via the typeahead parameter in the search endpoint (Fuzzy Search | Search API).

Hope this helps!
Best,
Wouter (PM Search)

3 Likes

Yeah you are right. Thanks for the guidance.

Hello, i have actually encountered with an issue with fuzzy search . Lets say if i want to search address against some post, like SE4 1BQ and if put a limit of 100 for results, so i am getting those address as well which do not have post code SE4 1BQ. its working fine with the limit of 30 but in more i am getting vague results, any suggestion i can make my result more precise ? or i am missing something. thanks in advance.

We have about 30 addresses for that postal code, so if you would go lower than result 30 you get to search results that partially match the query (for example, only the SE4 part). Could you explain what you are trying to achieve, maybe I can help you a bit better.

thanks for responding and yes you are right, we get the result if matches to any of query string, i mean postal code. Like SE4 1DH. but the thing is, in this postal code or many more, just take this SE4 1DH, i get some specific results as well as results like S20 1DH, S20 1EQ. now here’s an issue, it starts with S20, because first part of postal code matters the most, I want results only which have SE4 , not S20 or whatsoever, i want precision in my results. can i restrict it somehow ? or can i make it more specific ? like countrySet restrict results, i want the agaisnt my entered postal code. because i am almost there but i am facing this one issue, rest of thing is fine.

What you can try is the following three-stage approach:

  1. Search for the main postal code (SE4) and limit search results to PostalCodeArea (entityTypeSet=PostalCodeArea).
  2. Get the dataSources.geometry.id from the response and use that for the Additional Data endpoint to get the geometry polygon for the area
  3. Finally, you can use the Geometry Search endpoint to limit your search results to only those within the provided geometry (e.g., the geometry for SE4).

This is the most reliable way to filter results for a given area. Hope this helps.

I followed the steps you mentioned, But maybe i am missing something, First i get the geometry id from fuzzy search and then run additional endpoint to get coordinates and then call the geometry search call. i have just passed few of the coordinates which i get from additional endpoint. as you see in image.

From your questions before I understood you are trying to find “something” in a specific postal code area (SE4). The steps I provided allow you to restrict your search results to only those inside the SE4 postal code area (just like you would limit search results to a country using countrySet).

It looks like you did all the required steps, but in the call to geometrySearch you would have to provide what you are searching for within the postal code area. The screenshot shows you searched for “SE4”, but you are already limiting results to that area by sending the geometry. Searching for something like “pizza” or a particular categorySet will return matching results for that query inside the geometry.

let me briefly explain, As in fuzzy search, If i pass post code SE4 1DH or whatever (applying limit of 100 also countrySet for example) , i want all the address against that post code. which i am getting actually but the thing i am getting those result which outside of scope of SE4, like i am getting addresses of post code BR3 1DH, which i doesnt matter. i get it why i am getting these result because of query string matches. I want all the address against SE4 , doesnt matter what’s ahead of SE4, like 1DH, 1BQ etc. So thats why i mentioned, i want to restrict addresses , All i want addresses against some post code. Categories doesnt have to do with any of it. Fuzzy search is giving me results but as i mentioned some other results out scope of SE4 post code as well.

Thanks for explaining the case. This kind of structured, database-like access to our data is currently not available. Listing all addresses within a postal code area, or within a municipality or other region is not an expected/supported use case for the Search API. The Search API is a search engine that focuses on finding the most relevant result for a given input query and it is not a database you can query to get a full set of results.

The case you’re describing has been brought up before, so we do have this type of “database-like” functionality listed as one of potential improvements of our API offering.

Lets just focus on addresses for a moment, There’s an another issue that i want to bring into your notice about search api, which provides addresses. So there’s another third party platform which returns the result to more accuracy or you can say more detailed output, i believe. Because i have double checked it with people who actually lives there. so lets say there’s a post code E14 3AE , out of many result one should be 413 Westferry Road, , , , , London and so on like detailed output . Why not TomTom fetching out those results like this, Let me show it you as well and there are other examples too.

TomTom only fetch a single record against E14 3AE, there are other results as well but they are like E15,SE19. That should not included first of all, but lets just forget about this for a moment, what about
against this postal code E14 3AE , as i have shown a reference image , there are plenty.

This is indeed a known content gap: we do not have all individual addresses in the UK. We would love to improve that, but there are many factors that play a role in that decision. Unfortunately, I cannot say if or when we will improve that.