Displaying Listings Similar to Search Results

Searching for similar things/places based on some parameters is quite normal in the current online world. Therefore, displaying listings that are similar to what users are looking for is a must for businesses and throws a challenge for developers. Here, I have explained a scenario taking Real Estate web application as an example.


A real estate web application has multiple property listings where a user will search for one property and would like to explore similar properties in that particular area. In this scenario, we need to display all the properties based on Geo Location and Zip Code.


 Save the Geo-Location (Latitude and Longitude) and Zip Code of the Property while it is listing.

Property Listing and Validation

Step 1:

Before updating any property, we should get inputs from user:

1) Street Line 1

2) Street Line 2

3) City

4) State

5) Country

6) Zip Code

Step 2:

Get Geo Location (i.e. Latitude and Longitude)

a) By Address:

//calling Google maps API for fetching Geo-Location Based on address

"https://maps.googleapis.com/maps/api/geocode/json?address=" + <FullAddress> + "&sensor=true&key=" + <GoogleApiKey>

Similar Search Results

b) By Zip Code and Country Code:

//calling Google maps API for fetching Geo Location Based on Country Code and Zip code

"https://maps.googleapis.com/maps/api/geocode/json?components=country:" + <Country> + "|postal_code:" +  <pincode> + "&sensor=true&key=" + <GoogleApiKey>;

Step 3:

Validating Zip Code:

The two Geo Locations needs to be compared by taking approximate round off values, and if both of them matches then we allow a user to move to the next step else we should clear zip code field and give an alert message like ‘wrong zip code entered’.

Step 4:

Save the Latitude and Longitude into the Address Table.



To display similar listings when a user clicks on similar property option, the below process needs to be followed:

Step 1:

We will get below input parameters of the clicked property listing:

1) Latitude

2) Longitude

3) Price Range (Min and Max)

4) Zip Code

Step 2: (Optional based on application requirement)

In addition to Step 1, we should add two more input parameters

1) Distance Unit ( Constant  : 111.045 km per degree & 69 statute miles per degree or 60 nautical miles per degree & 552 furlongs per degree)  ~ 12.92297284

2) Radius (Km Radius) ~ 05.0

Step 3:

By gathering input parameters from step 1 & 2, call custom API, get dataset and bind back to the UI.

The Custom API is responsible for below operations

1) Taking Input parameters

2) Querying Database and fetching data from property table based on the input parameters

3) Sending the result dataset back to the client


End user will be able to see various Similar Property Listings which falls under below criteria of the clicked property

1) Within Price Range (Min & Max)

2) Within 5 Km Radius of the Geo Location (Latitude and Longitude)

3) With Same Zip Code


The above process can be used for various applications to implement similar search. However, the search criteria can be changed based on the requirement.

About Uday Kiran

Uday Kiran is an Senior software engineer at Vmoksha Technologies. He is passionate about exploring new automation technologies for cloud,mobile and web application . He loves reading novels, traveling, and trekking. He has done Master's at Andhra University.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>