- Insights This article was written by a TIA community member. Insights pieces undergo the same rigorous editorial process that newsroom-produced articles have.
How we improved our search feature’s response time at Traveloka

Photo credit: berlinimpressions / 123RF
This article is part of Tech in Asia’s partnership with Traveloka, where we publish articles that feature the company’s valuable insights. Read more from Traveloka here.
Previously, I wrote about how we at Traveloka overcame the challenges in building an accurate autocomplete search feature. In this post, we will look into latency.
No matter how good an autocomplete feature is, the user experience won’t be smooth if it takes too long to fetch results. In fact, 0.1 second is the ideal response time.
Particularly, the search-as-you-type feature is challenging to scale due to the massive amount of requests. Every character typed means another query to the server.
Fortunately, there are several ways to improve the performance of an autocomplete search feature.
1. Moving the computation intensive part from query time to indexing time
It is essential for the query time to be fast, but the indexing time doesn’t impact the user since it happens behind the scene.

Photo credit: Voor Media
Take the synonym analyzer process as an example. In text search, we expand every token with their synonyms. The word “big” is expanded to “large,” “huge,” “humongous,” “extensive,” and so on. We do this so that a query will also be searchable by its synonym.
There are two options to implement this: during indexing or query.
If it is applied during indexing, tokens in the index will be supplemented with their synonyms. For example, a document “Spacious hotel in Jakarta” becomes “Huge, large, humongous hotel in Jakarta” in the index. Consequently, the index size swells.
If synonym is implemented at query time, the index size will still be the same, but the amount of query increases since we will also query the synonym afterwards. For example, if the query is “Spacious hotel in Jakarta,” we will also query “Big hotel in Jakarta,” “Massive hotel in Jakarta,” etc. Hence, the noticeable effect is an increase in search latency.
Unfortunately, deciding to implement synonym whether at index time or query time is not that simple. There are pros and cons.
2. Modelling document for high performance
3. Using shards and replica
4. Choosing hardware that eases performance bottlenecks
Stay updated on the go with our mobile app.
Get latest insights with smoother, more personalized experience through TIA mobile app.






