Hotel Availability Comparison - Skip Header

ostermiller.org

Main
Articles
Games
Java
Calculators

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.

Features

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

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.