Facebook Search in Graph API - ios

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?

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

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.

It is not just the graph search. When you refresh your TimeLine. The order of posts gets changed every time because Facebook takes a Pull on Demand approach. Which means whenever you login, the data from your friends is fetched. Which is why facebook has a limit to maximum number of friends.
Talking about the Graph search and Graph API. They are not same and the Graph Search cannot be accessed through the Graph API. So, you would have to change your approach.
To explain why the graph search gives different results on same search term. I would guess that it follows the game Pull on Demand model ( although it is not open and we cannot know for sure ). Following that model makes sense though.
Thanks

Related

Beginner Question: How to access the number of impressions from *other users'* tweets?

I've got a bunch of free online HTML, CSS, and JS tutorials under my belt and I want to try using them to make a browser extension. But I want to make sure that the data I want to use is actually accessible before getting started.
My goal is to make a browser extension for twitter.com that shows the number of impressions of any tweet next to the likes, retweets, and replies. My basic idea is to get the status URL of any given tweet, poll the Twitter API for the number of impressions of that tweet, store that in a variable, and then use CSS to display a little eye icon and the number stored in the impressions variable.
I know that I can find the number of impressions of all of my tweets, both through Twitter Analytics, and also just going to my profile page and clicking the little bar chart icon next to views, retweets, etc. But I'm not clear on whether I can do that for other people's tweets via Twitter's API or anything else. Can you?
For the record, I'm not too concerned about the varying definition of "impression," since it will be consistently applied across all tweets and I'm mostly interested in giving users a comparison between tweets. This is part of a research project to see how this might change how people engage with social media if they know how many views a given post has. If there's a simpler way to go about that using existing platforms, I'm open to suggestions.
Thanks for the advice!
No, impressions data is private. If you are authenticated to the Twitter API then you can use the new Twitter Developer Labs Tweets API to get private metrics like impressions, but you cannot get that for other people's Tweets. Also, the Twitter API does not support CORS, so I don't think you'll be successful trying to use it from a browser extension.

How can I filter the friends returned from a facebook graph API request?

I need to retrieve all facebook friends which match some sort of filter or pattern. I am currently calling this:
me/friends?fields=name,id
This returns all friends which have also downloaded my app. However, is there a way to filter the returned friends by name? I want to avoid retrieving all friends and then filtering the results on the client side to minimise the size of the result since there could be a lot of results. I know that FQL supported this, but it has been deprecated in favour of the graph API, however despite looking around everywhere I am surprised to not have found an answer to what I thought would be a pretty common requirement.
To give a bit of context, I'm simply providing the user with a text field with which they can filter their friends, and so want to make requests on the graph API like this:
me/friends?fields=name,id&name=%Pat%
Thanks
Facebook SDK gives you the option to retrieve either the friends that use the application or the one who haven't downloaded it yet (for invitation purposes etc.)
However, if you would like to filter them you will have to do it in the FE. Facebook SDK doesn't support such functionality yet.
Cheers

Facebook iOS SDK invitable_friends v2.4

I have a Facebook iOS app, and I'd like to allow my users to invite their Facebook friends to my app. The proper endpoint is /{userId}/invitable_friends which is working well. But towards the bottom of that doc page, they recommend implementing a "search box" to filter the results, yet they don't offer any example of how to do this. I've searched around and haven't found anything.
It doesn't appear as though you can pass additional params for filtering the results. Obviously I can filter the results after the fact, but that's not scalable since the API only returns ~20 users at a time. That limit is modifiable (I believe), though it's of course not wise to bump it too high.
So how can I build a search box interface if I can't pass the search text to the endpoint? I must be missing something.
Thanks in advance.
https://developers.facebook.com/docs/games/invitable-friends/v2.4
i look up this tutorial...

Tweets, Location, Keywords and Data

I'm trying do some analysis on locations where people are going during winters. The approach I'm following is get tweets from a specific city (say, New York) and with the keyword Foursquare. Then use foursquare data for that user to see his/her checkins and try to trace a pattern.
So, I'm stuck in the first phase. How do I get those tweets from ONE city and with the keyword FOURSQUARE. I'm not sure if I understood how to use streaming API correctly and the ReST API isn't working (shows NOT AUTHORISED)
Could you tell me a detailed procedure for a rookie to understand the process of doing the above mentioned process. Also, let me know if you have a better approach for analysing trends in check ins.
Thanks
You want to read these:
https://dev.twitter.com/docs/api/1/get/search
https://dev.twitter.com/docs/platform-objects/places
You can give Twitter a latitude/longitude coordinate and a radius, or you can use the "place" field as a filter. Either way, expect to fine-tune this a bit to fit your needs. You also need to take into account that a lot of people might tweet without location services enabled.
If you want to use the REST API, you need to get an API key from twitter.

Get follower count on Twitter API search results

What I'm trying to do is pull some search results, and sort them by users.
Right now I'm using
$to->OAuthRequest('http://search.twitter.com/search.json', array('q' => 'search-term'), 'GET');
to get the results, but I can't actually get information about the user like follower_count, etc. so I though I'd take each result's user_id, and run it through http://twitter.com/users/show.xml to get the rest of the information.
The problem is, if I get 50 results that way, that's 50 API calls, which is 1/3 of the hourly limit...
Is there a better way to do this?
Update:
I have requested whitelisting, and the guys at Twitter told me I should instead use the new Streaming API.
This kinda sucks since it's in Alpha testing, and the documentation is unclear, but the concept looks cool, and the limits are different than the regular API. Gonna dive into it later.
Only reliable user information you can get from twitter search results are username (from_user) and profile image url. If you want more information, you will have to call the users/show method for each user. There is no workaround or better way(that I'm aware of).
You will have to Cache user information and request whitelisting.

Resources