Places...LIMIT results to only include those that have street included

Currently implementing Places using algolia’s DB records, not my own private data set. I have the type set as ‘address’, countries set as ‘us’, and using default aroundLatLng to use user IP address. Wanting to know if it’s possible to not include results that do not include a street address. For example. if I search ‘1533’, all my top results are simply towns in Pennsylvania (assuming it matches that zip/postal code).

First, can I only return results that include street address? I have a feeling the answer is No, because Algolia owns the data and has set what is and isn’t searchable.

Second, I’m in Nashville, TN so have others found issues with reliability of IP fencing to help search? Or, know of a more effective way to use Places?

Hi @zach1

As you said, if you want to filter results to return only addresses and not the other types, you can specify that in the options setting the parameter like so: type: "address".

I just tested it, and indeed, it only returns streets that matches 1533 in their street name (usually road name). So I’m not sure of the issue you are facing.

To dig further, can you give me a full query example and the response you got?

Concerning the bias via IP, we don’t have any complaint about it. From all of our tests, this is working great. That said, we had a global issue with geo-IP last month for a few hours, which badly located some IPs.
The geo-IP database is updated regularly and is pretty precise. It is possible that a few IPs are wrongly located but as I said earlier, we don’t have open issues about it.

We highly recommend to let the default behavior of aroundLatLngViaIP set to true, as the relevancy of search for your users a improved. If you experience some issues with, please share more information to us so we can investigate it. In the meantime, you could set it to false.

Let me know if that helps!

Thanks Raphael.
I’m already specifying type:address in my options and using default LatLng settings, as you can see here:

(function() {
  var placesAutocomplete = places({
    container: document.querySelector('#address-autocomplete'),
    type: 'address',
    countries: 'us',
    style: false,
    templates: {
      value: function(suggestion) {
        console.log(suggestion);
        var strings = suggestion.name + ", " + suggestion.city + ", " + suggestion.administrative
        return strings;
      }
    }
  });
  placesAutocomplete.on('change', function resultSelected(e) {
    document.querySelector('#street_number').value = e.suggestion.name || '';
    document.querySelector('#form-address2').value = e.suggestion.administrative || '';
    document.querySelector('#form-city').value = e.suggestion.city || '';
    document.querySelector('#form-zip').value = e.suggestion.postcode || '';
    validateAddress(e.suggestion.name);
  });
})();
</script>

Let me try and clarify on the search/return issue…So when I start search 1533, you can see in the attached screenshot, the responses are all cities. No actual addresses included until you type a letter or something. Also, in second screenshot when searching 1312, I am literally at an address of 1312 in Nashville, TN and that is not even included in options returned so it clearly isn’t very effective in using IP fencing.

09 AM

00 AM

Another side question, is there a way to specify response to include the abbreviated state? For example, Arizona would return AZ.

Hope this helps…Thanks::Zach

So no feedback?..

A year later and I’m facing the same problem - did you ever come up with a solution, or did you have to use an alternative platform?

Sorry to see that this thread got buried under other ones.

I’ll try to investigate this together with you if that’s alright.

Are you facing the same issue as zach1?

In order to help us understand your issue, would it be possible for you to answer the following questions:

  • are you using aroundLatLngViaIP: false?
  • are you using useDeviceLocation: true?
  • are you restricting your queries to a single country (like the us)?
  • are you restricting the type of queries to address only?
  • are your queries returning degradedQuery: true? (you can check if this is the case by looking at the rawAnswer.degradedQuery field in the suggestions event)

Would you mind also sharing the queries you tried, including the answers they returned (ideally in text format), and what you would expect instead? The reason for the text format is that if you are not using aroundLatLngViaIP: false, there will be a bias in the query based on your IP, which makes it hard for us to troubleshoot without having access to the returned data.

I hope this will help us understand what the issue is exactly!

Thanks for taking the time Jonathan. I’m not entirely sure it’s an issue so much as perhaps the lack of filtering option built into Algolia just yet - but I hope I could be wrong.

At the moment I would like to only have residential street addresses, but suburbs and sometimes highways are being presented as options in-between.

If you see below, you will see what I mean.


My current configuration is as follows:

placesAutocomplete.configure({
  language: 'en',
  countries: ['au'],
  type: 'address',
  aroundRadius: 200000,
  aroundLatLng: `${lat}, ${lng}`
});

So, my desire is to only have 123 Jones Street type results, residential only.