Stephen Ostermiller's Blog

TripAdvisor’s Hotel Availability Comparison

Since I spent about six months of my professional life working on TripAdvisor's hotel availability comparison feature, I thought a little writeup about it here would be appropriate. If you fill in the form over on the right you will be taken to a page on TripAdvisor that shows hotels that are available for the dates that you chose.


  • Accepts your specific information (destination, dates, number of guests)
  • Shows you only hotels which have rooms available for your dates. Availability is gathered from the big on-line travel agencies and individual hotel chain websites.
    • Expedia
    • Wyndham
    • Etc.
  • Sorts hotels by TripAdvisor's popularity index so you are sure to get a hotel with a good reputation in which you will have an enjoyable stay.
  • You get all the information you need to choose your hotel:
    • Photos
    • Descriptions
    • Ratings
    • User reviews
    • Price information
  • Use TripAdvisor's QuickCheck feature to find the best price for the hotel from the various vendors and then book your room.

Behind the Scenes

On the fly, TripAdvisor fetches pricing and availability information from the vendor websites and shows you hotels that are available as they are found. That is a fairly tall order. Two engineers worked on the project non-stop for six months while another two engineers helped out for a couple months each.

The pieces

  • Hotel database - We used the existing list of hotels along with the links to the hotel on various vendor sites that is one of TripAdvisor's main assets.
  • Crawlers - To fetch information from vendor sites
  • Permission - To run crawlers that would fetch thousands of pages from the vendor sites every day.
  • Scalability - Multiple machines to run these queries and report back to the web servers
  • User interface - Web page that would dynamically update as the crawlers found hotels.

Nifty Tidbits

When your browser downloads the page, the browser will check back with the server every 3 seconds until all the hotels have been checked. Google maps uses XMLHttpRequest to request XML data and displays it with an XSLT transform using a process that has been dubbed Ajax. We took a slightly different approach and used a JavaScript remote procedure call methodology. In our model, a hidden iframe is refreshed. JavaScript in that iframe copies html from the iframe into the main document. If all the data is not back yet, it also sets the iframe to refresh again in 3 seconds.

If you refresh a page, the hotels will all appear immediately because it caches the results of the crawls for a while. You also may see all the hotels appear right away if you search for a popular city with the default dates. In that case somebody else may have requested that the crawls happen.

The search component that support the destination field just "does the right thing" most of the time. If you enter "Paris", it knows you mean Paris France not Paris Texas. But if you enter Portland, it will let you choose between Portland Oregon and Portland Maine. It even accepts quite a wide variety of common misspellings.

Leave a comment

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