简体   繁体   中英

Facebook Graph API Non English Search Queries

I've been trying to use facebook graph api public search. It works just fine for english search queries, for example, http://graph.facebook.com/search?q=watermelon%20&type=post

On the other hand, while setting a non english search result, I'm also receiving only english results, but non of the results in a result in the language of the search query.

For example, http://graph.facebook.com/search?q=ביבי&type=post

Does not return any relevant result (the search query is "ביבי" , a word in Hebrew. None of the returned results are in Hebrew).

What could I do to fix it ?

Any suggestion will be helpful.

Thanks in advance.

To receive response in a locale which is different from your computer default locale, you should specify it with the request. Right now there are 2 ways to do that:

  1. use &locale=he_IL in the URL ( list of Facebook locales ), eg

    https://graph.facebook.com/search?q=YOUR_QUERY&type=post&fields=message&locale=he_IL

  2. use Accept-Language header with your request, eg

    'Accept-Language': 'he_IL,he,iw;q=0.9'

Recently, the first approach had a bug (now it works well), so I would use both of them (the first one will have more priority then another).

Note: Search across the specified locale will return posts available in this locale.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM