A Real Estate website contains listings for residential or commercial properties, on sale, lease or rent. For a city there maybe hundreds of listings. For a country wide real estate website, this number will be substantially larger. Each property has certain attributes, like location, area, price, description, etc. Considering that such parameters would be considered when searching for a listing on a country wide real estate website, the complexity of the search increases.
Advanced Listings Search Feature
An advanced search for property listings should have the following features:
-
Auto Suggest Locations: For a property listings search, the most important search criteria, is the location. The location field should accept an accurate search location, detailed right down to the zip code. To autosuggest locations based on keywords entered by a user, you would need a database with all relevant locations in the area. There are several databases available, like Geonames, which provide you with address information. Your search box should also provide spelling suggestions, like ‘Did you mean…’ for misspelled place names.
-
Broad Match Search: Usually, the keywords entered in the search criteria are matched exactly and search results are displayed. The default WordPress search, provides phrase matching, and is very limited. A better option is to have a broad match search. In a broad match search, not only the phrase is searched for, but also individual words, and close variations are also searched.
-
Fast Search: When searching through a large database of posted listings, providing an optimized and speedy search is the most important. A search server which uses indexing can substantially speed up a search query. Instead of going through each and every document to find a word being searched, indexing links words to pages (similar to a glossary index in a book).
To provide an advanced search capability, you will need to install and configure a search server, such as Sphinx or Solr.
[space]
Advantages of Using Sphinx or Solr
Using an advanced search server like Sphinx or Solr can offer you the above mentioned features. Apart from these, you can benefit from additional features provided.
-
Assigning weights to parameters: Each parameter used for the search (e.g., location, price, etc), has priorities. For example, location might be of the highest priority, thus it will drive the search results. Next might be price, and then the other factors. Each factor will have a weight which decides the priority.
-
Search Location Suggestions: If the search criteria does not match any listing for a particular location, the search server would suggest near by locations, based on recognized location data. If a database like Geonames is used, you can provide suggestions like: “Search for Properties Nearby: Location 1, Location 2, Location 3…”, etc.
-
Highly Scalable: For a real estate website, new listings will be added frequently, thus the search server has to be highly scalable. The search engine servers have to be highly scalable. Assured scalability is provided by the use of Sphinx or Solr. (For Sphinx the biggest known cluster indexes over 3 billion documents). What you would need to do is automate the server to regularly index new content that comes on the site.
-
Sorting and Filtering Options: The search results can be sorted not only based on the relevancy, but also based on the freshness of the listing. Thus most recent listings can be displayed first. Filtering options are also provided, such as price range filters, locality filters, etc.
[space]
Configuring Sphinx or Solr Search
To integrate such a search feature in your website, you will have to install the search server and configure it. For Sphinx server installation, you need to go to http://sphinxsearch.com/. For configuration of Sphinx, please refer to our extensive blog post, as a guide for configuration of Sphinx Search for WordPress.
To set up Solr server, you need to download the latest version from http://lucene.apache.org/solr/. You need to configure the Solr server and set up the indexes. To integrate Solr search into your WordPress website, you need to use the WPSOLR plugin.
Sphinx and Solr are truly powerful search servers. The key is to configure them correctly, so as to benefit from their features. Stay tuned articles, with tips and tricks for configuring Sphinx and Solr servers, such as how to schedule regular updates of indexes using a cron job, and common use case solutions.