How to limit search results with several conditions - facebook

I am using search function in Graph API to look for my results. However, these are usually too general. I would like to narrow results but I can't find a way to do it - Graph API offer me only narrowing results by time. On the other hand, FQL does not offer me possibility to obtain results without having IDs of objects.
I figured that the only way is to get results by Graph API and then make FQL query for each result. Do you have any other ideas?

You can search various objects in Facebook using GRAPH API.
You can search over all public objects in the social graph with
https://graph.facebook.com/search.
The format is:
https://graph.facebook.com/search?q=QUERY&type=OBJECT_TYPE
Reference
https://developers.facebook.com/docs/reference/api/

Related

Why is there difference in the post available fields between Graph API Reference and the exploration tool?

I'm trying to read some post information about some FB pages/profiles. I'm considering the Graph API version v2.8, and following this documentation.
But there are some fileds accessible from the Graph API that are not listed in the above link, for example the fields is_popular, target, promotion_status and timeline_visibility.
So far, the first two parameters didn't give me any result, but I can obtain both the promotion_status and timeline_visibility results from some posts. How can be possible that the set of the available fields in the reference and in the graph API tool are different for the same version of the API? Should I avoid to request these feelds and lean my word on them?

Facebook Graph API Search "Unofficial Results"

I'm using the Facebook Graph API to search for a business's Page. I've included type=page in the search query, however the results contain several Place results that are listed as "Unofficial Pages".
Is there an easy way to filter the Unofficial Pages out of the results? I can't seem to find any documentation on how to do this.
For example, a local search is returning the following results for the same business....
Official Page: https://www.facebook.com/Turtle-Creek-Vineyard-1652393331683838/
Unofficial Place: https://www.facebook.com/pages/Turtle-Creek-Vineyard/130640440336061
I would like to figure out how to have the first, official result returned only. Or, if there is parameter that I can use to filter out the unofficial, place results.
There is no filter option according to the docs about the Search API: https://developers.facebook.com/docs/graph-api/using-graph-api#search
You will have to filter on your own after getting the results.
Use the Field "is_unclaimed". If it is true, that's mean that the page is "Unofficial Page".

Get the comment of a specific User- Facebook API

I want to get the list of comments made by given user through Facebook Graph API.
I haven't found any direct way to get lists of comments. So, I tried to find them through my feed, but it's returning all feed posts. Can we filter other posts where I have not commented?
I tried various queries as below, but could not get exactly what I need.
/me/feed?fields=comments?fields=from?name="my_name",message
/me/feed?fields=comments.fields(from.name("my_name"),message)
I need either (1) list of all comments by me or else (2) lists of posts which I have commented on, filtering out all other posts.
How can we do this?
There's no way to filter via the Graph API. Basically what you want to achieve is IMHO not really possible.
What you could theoretically do is use the comment FQL table, but the field you'd need (fromid) is not indexable: https://developers.facebook.com/docs/reference/fql/comment/ So this could be tough.

Graph API's search returning considerately less public posts than Facebook's user facing search?

I'm developing an application based on facebook's data using the Graph API. Part of the functionality entails searching Facebook's public post, essentially in the same fashion that Facebook does on www.facebook.com/search:
http://www.facebook.com/search/results.php?q=thanksgiving&type=eposts&init=quick&tas=0.31611707084812224
However, when I issue the same search via the Graph API, the results return miss many of the posts shown in the standard user interface. Many of the most recent posts returned by the standard search are missing (replace the access_token to the one you have):
https://graph.facebook.com/search?q=thanksgiving&type=post&access_token=XXXX
Does anyone have an idea what can cause this and how I can work around it? I have customer questioning the quality of my application because of this difference.
Many thanks,
Boaz
That is because the Graph API uses pagination if it returns too many objects, if you take a look on the bottom of the response of the "Nike" search you will find this:
"paging": {
"previous": "https://graph.facebook.com/search?q=nike&type=post&access_token=XX&limit=25&since=1322257702&__previous=1",
"next": "https://graph.facebook.com/search?q=nike&type=post&access_token=XX&limit=25&until=1322246079"
}
Just make another request to the "next" url in order to fetch more results.

Getting the large picture in search results with Facebook Graph API

In Facebook Graph API, I'm trying to get the large picture of each user in a search result. The following call will give me the small picture of each user:
https://graph.facebook.com/search?q=Bob%20Grossman&fields=name,id,picture&limit=10&type=user&access_token=*
It's rather easy to get the large picture for a single user, by adding the type=large parameter. But that seems to be ignored when searching (probably since there's already a 'type' parameter used to filter the search results).
Is there any way I can do it with Graph API?
Thanks!
My approach was to pre-fetch all users with the large and square pictures so that I can choose to use either. As far as I know, you cannot do this with the Graph API because the Graph API is pre-defined to present a specific output.
Let me know if you need more information around this.