How to set up search in a startup that plans to grow to VKontakte scale

Bogdan Garkushin21 Sep 2023

Problem

Without search, users cannot find what they need, decide it is not there and leave for another service. What search needs depends on the stage: at launch there is almost no data or load, later results do not fit one screen, and later still one server cannot carry the data and traffic. The author, who leads search at VKontakte, names the metrics, engine, ranking and architecture that fit each stage.

Example from the article: in VKontakte people search, a query for a person by name returned thousands of results and the author could not find her. This led to the hypothesis that distance could be a ranking criterion.

Solution in brief

Pick the metrics first (conversion, search, audience). Then grow in four stages: database search for the MVP, a search engine once functional requirements appear, ranking criteria and ML once results no longer fit one screen, and replication, sharding and per-service clusters under load. Each new ranking criterion is tested against the target action it should raise.

Questions this case answers
  • How to choose the search engine, ranking approach and architecture that fit the current stage of a product, so that complexity grows only when users and data require it
  • How to find ranking criteria that raise the target action coming from search results, and verify the gain with a metric that sits beyond search itself
  • How to decide what search a product needs at the MVP, growth and large-scale stages?
  • How to measure whether a search change actually helps users?

Tools and methods

  • Sphinx, Elasticsearch, Solr, Vespa, Lucene — ready-made engines and a library for the engine stage.
  • Ranking formula, then ML ranking — hand-made until about five criteria, ML after that.
  • FastText, BERT — text vectors, synonyms and query expansion for complex ML.
  • Replication, sharding, load balancer — serving more load and more data.
Continue reading — it's free

Google or a one-time email code. No password.