Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Facebook Search in Graph API

I'm developing an iOS application that let the user to search for a person throught the Graph API.

What I want is the SAME behavior that it's present on the Facebook website. You know when you begin to search for a person in the top text input? The first results will be mostly your friends AND some people you MAY know or people you already looked for.

The problem? Try to use the same search pattern here to search a person: Graph Api Explorer

The Graph Api returns DIFFERENT results than the search input on the Facebook website.

Does anyone knows why? Is there a way to achieve the same results?

like image 797
Fred Collins Avatar asked Sep 06 '14 23:09

Fred Collins


2 Answers

Facebook are using many algorithms to display search result like Relevance Indicators, Complexities of User-Centric Search and The Product.

One of the algorithm to display result on their page as below.

Personal Context:

Unlike most search engines, every Facebook search involves two key elements - a query and a querier.

Just as we need to understand the query, it’s as essential to understand the person behind the query.

People are more likely to be looking for things located in their own city/country or for people who share the same college/workplace.

We consider this information and much more when ranking results. The more we know about you, the better your search results will be.

In Graph API, they are not using this algorithm.They are just displaying the queried result. Hence you can not achieve same result using graph search API.

To achieve this you can use following apporach -

  • Get the friend list of user using me/friends?limit=1&offset=1
  • Get the user list using search api
  • merge both the result
  • show result(s) to user

For more information(approach/algorithm) you can check Intro to Facebook Search

like image 170
Rajesh Ujade Avatar answered Oct 03 '22 22:10

Rajesh Ujade


Is there a way to achieve the same results? - NO

Does anyone knows why? - NOT REALLY

(Edit: Seems in another answer, someone does actually, but it doesn't change the answer for "If you can achieve it")

But its safe to presume that Facebook does not allow all functionality through the API, why would they after all ? They need to keep the people coming to their own platform. So I can't give you a straight forward response on WHY, but IF ? Not possible, there is zero documentation about more specified search for type user. When you request user friends, you will only get the user friends who are using the same app starting v2.0

Am afraid that you will have to drop the functionality you want to achieve.

like image 20
Segers-Ian Avatar answered Oct 03 '22 22:10

Segers-Ian