Dev

How Graph Search really works: a tech tutorial from the friendly nerds at Facebook

Facebook’s Graph Search is still in its infancy, but the company is ready to talk about how it actually works.

Graph Search is based on the idea that we — Facebook users — are all connected to each other and to various places, things, ideas, and events in unique and specific ways. So when I search for “restaurants,” I’m not really looking for the web page with the best correlation to the string of letters “r-e-s-t-a-u-r-a-n-t-s.” I’m looking for something most computers (and most databases) would have a hard time finding: A restaurant near me that I’m likely to enjoy.

The company seeks to overturn the search-by-keyword paradigm by offering something better, a sort of object-oriented approach to search. And this emphasis on attributes and nodes and the connections or edges between them is something Facebook CEO Mark Zuckerberg called “a trip back to our roots.”

We got a technical overview of Graph Search at Facebook’s Menlo Park headquarters last month. Today, the company has posted a more in-depth technical explanation of Graph Search on its Engineering Notes page.

“Our goal is to maximize searcher happiness,” writes search infrastructure engineering manager Sriram Sankar today on the company blog.

“Now that we have launched Graph Search, we are learning from the usage to understand which queries are popular and how they need to be optimized. We are also extending our search capabilities to do better text processing and ranking and have better mobile and internationalization support. Finally, we are also working on building a completely new vertical to handle searching posts and comments.”

All this magic is built on Unicorn, a fancy system for building indices of data — some of them too large to fit on a single machine — and then getting the data back quickly when someone does a search. This involves sharding the indices and creating an “in-memory database” with its own query language.

Each type of Facebook node — people, events, photos, etc. — gets its own “vertical” in Unicorn, because each of them has very different attribute types. Then, there’s a top aggregator that organizes the queries across multiple verticals (for example, when you search for “my friends in Arizona” and need to access verticals of people and places at the same time).

Our more technically oriented readers should definitely go check out the whole post. And you know what? The non-tech folks should read it, too. It will give you a wonderful under-the-hood look at a web feature you might end up using every day — something you’re not too likely to get from Google Web Search or Bing.

blog comments powered by Disqus