Facebook Graph Search Secrets Revealed

Late last week, the Facebook team wrote a blog post that let users "under the hood" to show them how Graph Search goes about indexing and ranking search query results on the social network. 

Knowingly or not, what Facebook really did was reveal the secrets of social media optimization. Since "knowing" how things work is half the digital battle, let's dig into the details to accelerate your future Facebook (and more specifically Graph Search) success.

Graph Search and You
Of all of the information released in the blog post (and there is a lot), perhaps the most important and useful of it all is that Facebook is not only going to use Graph Search to find data, but also to build upon it and include new features that will quantify important elements of a search query to provide the most relevant information based on factors unique to a particular query. This includes the distance between a searcher and a place, how close a searcher is from user results in terms of friend connections and the amount of overlap a query may have with an entity name, among others. In other words, naming things right and having many friends are both great ways to improve your Facebook page's performance when it comes to graph search results.

If you care about social media optimization at all, use this information as a digital blueprint for a successful Facebook presence in Graph Search results.

In the future, this could mean that an entity (person, place, etc.) will have several different scores assigned to it, and Graph Search can select the top results based on those score. So, for instance, there could be three different scores for a "nearby" search that account for overall popularity, social bias and distance, thus allowing for greater diversity and more relevance in search results that are, ultimately, more useful for those searching, as well as those being searched for.

Let's Get Technical
It appears that Facebook uses a blending of data-driven techniques and "intuition" to rank the best results for a query by coming up with an idea for a ranking change (based on information from both ranking engineers and user feedback), implementing it, testing it and then launching it to a small fraction of users before measuring the impact it has on ranking changes. And it all starts with Unicorn.

Unicorn is an index framework and in-memory database that lets users (Facebook, in this case) create various vertical databases to house specific information, and then use a query language to retrieve that information later. However, before Facebook could begin to utilize Unicorn for Graph Search, the company had to add to its search ranking capabilities by adding things like query rewrites, forward indexing, A/B testing and extended retrieval operations with weak "and" and strong "or" recognition, in addition a number of other changes.

The Graph Search Lifecycle
All of these modifications serve Graph Search at different points throughout a query's lifecycle, which largely takes place in two distinct phases: the query suggestion phase and the search phase. In the query suggestion phase, the query that a user types into the search box is parsed based on grammar by a Natural Language Processing (NLP) module, which then identifies the query for potential entities, before sending them along to Unicorn to conduct a search for them.

This is perhaps the most important step in the whole process, as it defines what type of entity the searcher may be looking for, thus signaling where Unicorn should look for the information, as Facebook altered the index framework to keep different entity types in separate verticals. In other words, it tells Unicorn what kind of results to present. For example, if a user types in "people who live in Sri," the query will be sent with a strong bias toward cities and places, meaning location-based results will be more likely to appear because of the particular grammar qualifications of the query.



The search phase begins after a user had made a selection from Graph Search's suggestions. Again, all of this new information is sent back to Unicorn via the "Top Aggregator," which takes in raw query and user metadata information and then represents it at the end as the blended and rescored search results. This is where Graph Search is able to narrow down the original query to provide only relevant results unique to a user's search. In addition, Graph Search is able to rewrite queries into a social context to bias the results socially, as every user is indexed with his or her friends.