Jump to content

Recommended Posts

Hi, i'am looking for best practices in 2019 for Search on a website.  Very similar to rightmove / zoopla etc. 

1) They allow the user to search by county / postcode / town.  How is this list populated in the drop down?  is it a list of towns  in a plugin  which are then used as variables to populate the mysql select query,, or is it ajax populating the search input with a call to the db...

Reason iam confused it i know of a site with no property in a certain area but the list still predicts the area ...i.e. if no matching address is in the db how is it populating?  

 

2)  they also have a search function that once the user has arrived on the page by postcode..users are able to search 1/4 mile 1/2 mile radius etc from the  postcode for other properties...   how is this working?  

thx for your time in advance .   

in the jpeg i show the search box...when user types 'lon'    it brings up everything with lon in title i.e london, londonderry, long meadow  etc 

 

onmark.JPG

Edited by glendango
1 hour ago, glendango said:

1) They allow the user to search by county / postcode / town.  How is this list populated in the drop down?  is it a list of towns  in a plugin  which are then used as variables to populate the mysql select query,, or is it ajax populating the search input with a call to the db...

Reason iam confused it i know of a site with no property in a certain area but the list still predicts the area ...i.e. if no matching address is in the db how is it populating?  

They have a big database of locations. Probably purchased from and/or subscribed to a service that tracks stuff like that so they don't have to try to stay up to date themselves.

Quote

2)  they also have a search function that once the user has arrived on the page by postcode..users are able to search 1/4 mile 1/2 mile radius etc from the  postcode for other properties...   how is this working?  

They know the latitude and longitude of an address, also probably from a third-party service (eg, Google Maps). A postcode has a location too, though it's obviously not quite as precise. Then they can do some pretty simple math to estimate the distance between the two points.

  • Like 1

They have a big database of locations. Probably purchased from and/or subscribed to a service that tracks stuff like that so they don't have to try to stay up to date themselves.

 

interesting.   so do you think they use Ajax to get the locations from a database or would it be an API....   

once a user selects  e.g.  Islington, London    .

does this then add that as a $variable to a select statement to the database to create a list of properties on the next page ? 

$location = islington

select * from table where $location 

 

If ($lat, $lng) is the centre of the postcode area, then this will find the locations of properties within $d Km

select lat, lng from properties where 
pow(lat-$lat, 2) + pow((lng-$lng)*cos(radians($lat)), 2) < pow($d/110.25, 2)
  • Like 1
36 minutes ago, glendango said:

interesting.   so do you think they use Ajax to get the locations from a database or would it be an API....   

AJAX is a way for the browser to get something from the server without having to refresh the page. An API is merely what tells two things how to talk to each other.

Since they won't want to put every location onto the page (probably), yes: they will use AJAX to ask the server for a list of locations matching what the user types.

Quote

once a user selects  e.g.  Islington, London    .

does this then add that as a $variable to a select statement to the database to create a list of properties on the next page ? 

$location = islington

select * from table where $location 

Something like that.

furlongs lol...  

'something like that'  

anyone care to look at rightmove and tell me what the hell is going on under the hood?  could be ' typeahead' j.s . with a json file of postcodes and counties,.Could be ajax calling the locations from the database...

just because i type ajax into google doessnt mean that is the correct way to do it...  sweet jesus mother of god....   its like getting blood from bent coppers round here, so it is 

 

 

 

 

Edited by glendango
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.