Facebook API Multiple Search Type - facebook

Hi and thanks in advance.
I am currently working with the Facebook API, and I want to incorporate the search feature in my system, but the only problem is that I would like to do a search with one or more keywords for one or more type of object.
In other words not only search for posts but also, I would like to be able to search for posts, users and probably even events.
I have tried to put the parameter type like following type='post,user' but it doesn't return anything, the result is empty.
Is there a way to do it? The Facebook API manual doesn't say much about the search.

Related

Specify certain values with Facebook Graph request

I was wondering if there's a method to specify certain values of for instance "story" or "name" field when doing a request to the facebook graph. What I'm looking for is something like the following:
/{id}/feed?q={bla}&type={story}
Where I want to check a specific person/page's feed on a certain string of text within each story returned.
Hope you can help me out.
No, that is not possible.
Filtering and searching capabilities of the Graph API are very rudimentary.
When any endpoints support additional parameters of that sort, it is usually mentioned in the documentation.
But there is no way to filter a person’s or page’s feed for specific story types and message contents.

Dynamically search for Facebook pages on my site

I would like to have a search box on my site that works like the Facebook search box, but searching only for Pages.
I know that using the Graph API I can do searches like these:
search?q=London&type=page
and it will return a list of pages related to the keyword "London".
The difference is that I would like it to be dynamic. So that when the user starts typing "Lon" it starts suggesting pages. How can I do it?
Well the most straightforward is that you just call the API as the user types
search?q=L&type=page
search?q=Lo&type=page
search?q=Lon&type=page
search?q=Lond&type=page
search?q=Londo&type=page
search?q=London&type=page
And update your app view after each API call.

How to search Facebook's "invitable_friends" results

I have a Facebook app, and I'd like to allow my users to invite their Facebook friends to my app. The proper endpoint is /me/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.
PS - I'm using the JS SDK.
You should probably file a bug.
Based on the documentation the default size is 1000 records (average Facebook friend list size is 300-400)
If you don't see the next parameter at the end of the result under paging then there are no more results.

facebook public posts filtered by country

I'm using the facebook search API to get public posts. I want to filter it by country from which it was posted from. The place search graph api has a way to do this - by appending center and distance as query parameters. But the search api for type 'posts' does not respond to center or distance query parameters. I've looked into this SO question as well, but none of the answers have helped me accomplish my task.
As of now, the only solution I can think of is using a library to figure out the locale from the post string itself.
Note: I also thought of getting the user's location and then doing my own filtering, but that doesn't work either because I don't have the permissions to view the location/hometown of the user.
Anybody done this before?
https://developers.facebook.com/docs/reference/fql/location_post/ shows how you can read posts with location information. If that's not available, you could use the locale information in the User object from the Graph API, but that's not always visible/available either. Language detection (as you suggested in the question) may not be a great idea unless you have very specific needs. But, if the post language is in English, it's nearly impossible to tell the location considering the popularity of the language around the world.

Facebook Graph API SEO Comments and Profanity Filter

I'm trying to integrate the Facebook comments left on our site in a way in which the content can be crawled by search engines and also for people (although I highly doubt there will be many) who don't have Javascript enabled on their browser.
Currently our Facebook comments are displayed via the use of the Facebook comment social plugin (using the <fb:comments href="MY_URL" num_posts="50" width="665"></fb:comments> tag). This ends up rendering an iFrame (which are mostly ignored by search engine crawlers) so the plan is to render this information and format it with basic HTML. To do this, the comments are pulled using the Graph API - this is then only be displayed to crawlers and people with Javascript disabled.
This all works nicely using the Graph API call (https://graph.facebook.com/comments/?ids=MY_URL), parsing the JSON result and displaying it on the page. The problem is that the <fb:comments> approach filters our results based on a blacklist we have set up on one of our Facebook Apps. The AppId with the relevant blacklist is stored on the page using metadata (<meta property="fb:app_id" content="APP_ID"/>) which the <fb:comments> control obviously must somehow use to filter the comments.
The problem is the Graph API method does not filter any results as I guess no blacklist (or App Id containing a blacklist) is specified. Does anyone know how to specify a Facebook App ID to the API call URL or of another way to not fetch commnents back that violate the terms of the blacklist?
On a side note, I know the debate about filtering content in comments rages on but it is a management decision to implement the blacklist, and one that I have no influence in changing - just incase anyone felt the need to explain the reasons why content filtering is or isn't a good idea!
Any thoughts on a solution?
Unfortunately there's no way to access a filtered list of comments using the API - it might be a reasonably request to have this in the API - you should file a wishlist item in Facebook's bug tracker
Otherwise, the only solution I can think of is to implement your own filter on your side when retrieving and displaying the comments from the API.
According to the Comments plugin documentation the filter on Facebook's side is implemented as a simple substring match, so it should be trivial to implement.
A fairly simple regular expression match should be able to check each comment against a relatively long list quickly.
(Unfortunately, the tradeoff here is that implementing a filter is easy, but you'd also need to write an interface so that whoever's updating the list of disallowed words can maintain the list for both the Facebook plugin, and your own filtering.)
Quote from docs:
The comment is checked via substring matching. This means if you blacklist the
word 'at', if the comment contains the sequence 'a' 't' anywhere it will be
marked with limited visibility; e.g. if the comment contained the words 'bat',
'hat', 'attend', etc it would be caught.
Pretty sure there is no current way of doing this from the graph API, the only thing I can suggest is taking the blacklist and build your own filter