We asked ourselves this question more than once while working on improvements to search in March 2006. At the time, there were bigger search engines out there, including some good open source ones, that we could have used to power Facebook search results. However, we decided that searches carried out on Facebook had a particular structure that only we could understand and optimize for. We wrote a crawler for the site, created an in-memory reverse index using both hashes and ternary tries and created a ranking system that scaled to return unique results for over 28 million user profiles.
Some quick stats about Facebook search:
- Over 600 million searches per month. This makes us one of the top 20 search engines on the web in terms of number of searches.
- Approximately 1 terabyte of in-memory data.
- Average search query time of less than 100ms.
- Most used people search engine on the web.
Facebook search results are sorted by an approximation of social graph distance. People closer to you in the graph—your friends and people in your networks—are likely to be more relevant to you and thus are ranked higher. We also use this concept of "social proximity" to order results within applications like groups and events. Facebook search's key differentiator is that search results are unique to every user because they are based on a individual's place in the social graph.
We have big plans to improve Facebook search in the upcoming months. We want to leverage the power of the social graph to further improve the quality of the results and ensure that you find what you are looking for on Facebook.
Aditya Agarwal, a Facebook Tech Lead, is searching for an answer...