Facebook explains ranking system underneath Graph Search

While there is surely a financial interest involved, Facebook's engineering team defends that the goal of Graph Search is to "maximize searcher happiness."
Written by Rachel King, Contributor on

While many of Facebook's one billion users are still waiting to try out Graph Search, the engineering team behind the new infrastructure is offering a very technical look under the hood.

See also: Understanding Unicorn: A deep dive into Facebook's Graph Search

One aspect of Graph Search that could be equally important to both users and engineers is how search results are ranked.

Sriram Sankar, an engineering manager on Facebook's search infrastructure team, remarked in a blog post on Thursday morning that the goal is to "maximize searcher happiness."

Surely, there are also financial motivations at play here through ads and third-party apps.

Nevertheless, any monetization hopes start with ensuring that users get the best search results possible at the top of the feed. Facebook is attempting to accomplish this through Unicorn, which is the inverted index framework at the heart of Graph Search.

To understand just how detailed Sankar's description of how Unicorn works, here's a snippet:

A Unicorn instance (or vertical) may store an index that is too large to fit into the memory of a single machine. So we break up the index into multiple shards such that each shard can fit on a single machine. These machines are called index servers. Queries to Unicorn are sent to a Vertical Aggregator, which in turn broadcasts the queries to all index servers. Each index server retrieves entities from its shard and returns it to the Vertical Aggregator – which then combines all these entities and returns them to the caller.

Here's another way to look at that:


Sankar added that Unicorn, being essentially an "in-memory 'database' with a query language for retrieval," each entity type (i.e. users, pages, photos, etc.) is maintained in a separate Unicorn vertical with different ranking requirements with a "top aggregator" coordinating activities among these verticals.

More of the nitty-gritty specs about the Graph Search ranking system can be found on Facebook's engineering blog.

Images via The Facebook Engineering Blog

Editorial standards