Take the 2-minute tour ×
Web Applications Stack Exchange is a question and answer site for power users of web applications. It's 100% free, no registration required.

When you start searching for someone in Facebook's search bar, it will automatically start bringing back finds. What is the algorithm here? Is order arbitrary, and if not what determines it?

Edit: My reason for asking is that a friend of mine tried searching for "Rachel", and the first result was a Rachel that was friends with me. Their only common friend is me. Below her was another Rachel with whom he shared more mutual friends. This just seemed peculiar so I was wondering if anyone had some insight into why this might be the case.

share|improve this question

13 Answers 13

I don't know for certain (I don't work for Facebook!), but from my experience it seems to bring back results in (approximately) the following order:

  1. From your friends
  2. From your friends friends
  3. People with common interests (liked pages, shared groups etc.)

After this it starts to become more guesswork, but I suspect that home town, shared work places etc all come into play as well.

With more than 500 million users there's a lot of data and existing connections they can use to base their heuristics on

share|improve this answer

It starts with the letter of input makes a quick query from multiple database's and or tables. Say you start typing v. It looks first for any of your friends names that start with a v. If it finds a friend it then displays it.

I've noticed that if you have a friends page that you visit more often. If you then start typing the first letter it shows that as a first result. So it seems they save your frequently searched allowing them to give you better results.

share|improve this answer

It's possible that he is more active with you on facebook than with the other friends, which would place the first Rachel higher in the algorithm than the Rachel who is friends with people he doesn't interact with as much.

Again, this is just conjecture as I don't work for Facebook.

share|improve this answer

There is a pretty in-depth post about how Facebook Search works posted on Facebook Engineering's page:

http://www.facebook.com/note.php?note_id=365915113919

share|improve this answer
7  
Could you summarise the relevant section here. It guards against link rot (I know this is Facebook, but you never know). –  ChrisF Jan 25 '11 at 8:00

Here's what I've noticed. Whenever I search for a friend on facebook, I start to type the person's name, and after the first few letters, I get a list of people who's first or last name starts with the letters I've typed. NORMALLY, the list of friends starts with people I'm already friends with, and leads into people who I might possibly know through mutual friends. BUT...

I've recently started dating a guy. Now, when I type in the letter "G" to search my friend Georgia, the first person on my list is my boyfriend's best friend who's last name begins with "G". Then I tried "K" for Kelly. Instead of seeing my friend Kelly who would normally appear, I get a list of people with the last name Keats - my boyfriend's sisters, mother, aunt, and cousins. I haven't visited any of these profiles before, so I'm guessing that they're all checking out mine to see what the new girl is all about. That just goes to show that the search results are based, at least in part, on profile visits.

share|improve this answer

I feel it has to do with who views your page, for how long, who you view, for how long, and how frequently you search them. Your friends probably has a somewhat large value to show up first and/or their friends and the value can probably be lowered than a non-friend due to the time factor spent on a non-friend's page. Maybe even clicks is played into the search. There is a complicated formula. Facebook is crazy about this stuff. In the movie, when Mark (facebook CEO) did the site about which girl at school was hot or not, he ask a friend to come up with a formula to determine a winner. With how brilliant facebook has become, I don't doubt for a second that they take into consideration all these factors and 20,000 others when designing this formula.

I liked this guy and I couldn't find his page. Of course he was searching me as well and I'm assuming the reason why I was unable to search him was because he made his page only searchable to friends. (he has a girlfriend that's why and didn't want me to know) When he did allow me to search him, he was the first one after I typed his name. I didn't see this before.

share|improve this answer

I can definitely say that there are people who have come up on that list who are not my Facebook friends, and who I have never looked up, and I recognize them from my past. Also, I have an old flame who I looked up and he was at the top of my list there, then he moved to the third one down (all three starting with the letter A), and I didn't look him up again, and then he moved to the top.

Hard to say but I would guess the one's at the top are looking at your profile.

share|improve this answer

When I go on to my boyfriend's profile and type the letter C in his search bar then the first result is his ex girlfriend, whom he is not friends with on facebook, so I think it can show up the people who look at your page as he swears he's only been on her page once in the last year and a half and yet she shows up ahead of his friends pages. If this is not the case, he'll be single soon!

share|improve this answer
    
Does this give an in-depth view of how Facebook guesses the search? –  Jacob Jan Tuinstra Jan 6 '13 at 20:00

I believe that it could be someone that recently viewed your profile. No one else has brought this up.

share|improve this answer
    
Do you have a source for this information? –  Vidar S. Ramdal Oct 22 '13 at 7:35

Mutual friends show up first. As you type close to some name and the results are not your friends and you had never visited their profiles, then it is someone who visited you recently.

Also the pages and people you visit the most pop up first.

share|improve this answer

I am actually almost certain it has to do with people who view your page because I was thinking about this and conducted a little experiment (it's kinda confusing but bear with me).

I started off by typing every letter of the alphabet and seeing who came up on the search. So for example, I typed "A" and saw who came up. I noticed that the list of people were not necessarily in alphabetical order, but the people at the top were certainly my closest friends whose pages I visit all the time.

Then I thought maybe Facebook sets the search bar up conveniently for you to find the people you visit the most. But then I saw something strange, the girl that I just added was actually the second person in the "L" list, the first being my best friend, so that seemed odd to me.

So then I started thinking that it might actually have to do with the people who visit your page. To test the theory, I went to my "C" list, where the top two people were actually pretty much equal in terms of how many times I've visited their page and I assume they've visited mine. I went to the second person in the "C" list and clicked on their page a lot, refreshed it a few good times. Then I went back and searched "C" and sure enough, it was now the second friend whose page I had been refreshing who showed up first. I knew that this second friend was camping and had no Facebook/no way of looking at my page.

Now here's the real kicker: I told my other friend in the "C" list, the one who used to be first when I searched "C" to go on my page a couple of times. She did. I then took a couple of minutes and searched "C" again, and guess who came up first?

That's right, the girl who had just searched my page, despite the fact that I had been looking up the other girl's page recently.

Does this really prove that the Facebook search bar operates on people who have viewed your profile? Maybe, but it could also prove that I have WAY too much time on my hands.

share|improve this answer

I've been watching my friends search for a while..a little OCD... LOL and when I search someone who is a friend on facebook and one who is not a friend the most recent searched person moves to the top. I stopped looking at the one who is not a facebook friend expecting him to move down the list and he did for a while staying steady in the same spot for months then he went to the top of my list for weeks...This happened many times so I finally asked him about it and he denies looking at my profile but I don't believe him. it seems as though facebook keeps track of who you search first then who searches you(unless they look a lot then they go to the 1st position) then anyone you private message then ones you have the most interaction with.

share|improve this answer

I finally figured out the Facebook search bar trick!! So for years there's been this rumor that the search bar is the key to finding out who views your FB. They say it's just a legend... Not really!! So legend has it that if you type in a letter, the first result is either the person you searched for/looked at last... Or if you never have, that person has looked at you! Or they search for you frequently, or both.

( It also works based on interaction, for friends especially, but I have found this to work for friends who never interact with you, as well as friends of friends who have never had interaction.)

So I conducted a little experiment and found out that the trick does work - but ONLY IF YOU'RE BOTH SEARCHING  for each other! That's the missing link. I had someone view me... Nothing. They were still in position 4 down from the top. I search for someone else, who has not viewed me, and nothing - they're still a low result. But then I search for the person who viewed me on the same day, and boom! Less than 3 hours later, they were result number one when I typed in their first or last name initials!! Incidently, this works for friends, or friends of friends, even those who only have one mutual friend in common with you!

(Important: don't try to cheat by partially typing their name. First initial only, for first or last names! Also, this works for the full-site FB, which I use on my phone as a modification to the mobile FB. It does not work with the iPhone app.)

If you search for someone, friend or not, they will still show in your top 5 results for up to a day or so, then they rank lower and not even show in your top 3 if you don't search again. If you search for someone and they instantly (about 3 hours later) rank 1st after that, they've been searching for/looking at you too! If they eventually drop in ranking, either another one of your friends with the same initials interacted with you recently, or you're the only interested party...

Of course, this will be difficult to track if you're stalking them and click on them several times a day, LOL! But I've found that one single search is enough to set it off. ( I keep track of my searches by using the search log. Clearing your searches can throw off results after a couple of hours, too.) I've tried this experiment on multiple days... Same results. (In case you're wondering where I find the time, the answer is that I don't sleep a lot!)

share|improve this answer
    
I'm highly dubious. –  Al E. Dec 25 '13 at 15:48
    
It's true... I tested it multiple times. Same results. –  JGirl Jan 2 at 21:14

protected by jonsca Dec 28 '13 at 8:30

Thank you for your interest in this question. Because it has attracted low-quality answers, posting an answer now requires 10 reputation on this site.

Would you like to answer one of these unanswered questions instead?