Tired of ads? Enjoy an ad-free experience by signing up.
  • Insights
    This article was written by a TIA community member. Insights pieces undergo the same rigorous editorial process that newsroom-produced articles have.
Ismail Afiff · · 5 min read

How we improved our search feature’s response time at Traveloka

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.

index-vs-query

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 ahead in Asia’s tech landscape

You've reached your 2 free content limit for the month. Sign up for free to read the full story.

🏄 For casual readers / 👶 Free

Basic

US$0

Free forever

Get instant access to this article and more every month

0 premium content

Unlimited news briefs

5

5 articles

Ad-free reading experience

Just US$0 per day

⌛Sign up in 20s. No payment details needed.

📖 For learners / 👍 Starter

Lite

US$4.92/month

Billed annually at US$59/year

Get instant access to this article and more every month

4

4 premium content

Unlimited news briefs & articles

Ad-free reading experience

Just US$0.17 per day

Cancel anytime

Our subscriber community includes professionals from these companies:

Stay updated on the go with our mobile app.

Get latest insights with smoother, more personalized experience through TIA mobile app.

Community Writer

Ismail Afiff

Ismail is a backend software engineer at Traveloka. Currently, he is developing search engine for Traveloka, helping millions of users to find their next adventures. Besides search-engine, he is also interested in Computational Science and Engineering.