facebook graph api search rules
Does anyone have any idea what boolean logic is acceptable on the facebook graph api? They have the worst documentation, forums, assistance known to th开发者_Go百科e developer world. I tried using OR and it does not seem to be working. AND seems to be implied with spaces or commas.I am trying to search for multiple terms or using OR and NOT.
You can do AND and OR, when searching for posts, like: http://graph.facebook.com/search?q=watermelon%20|%20banana&type=post
The AND operator you can use with space or +: http://graph.facebook.com/search?q=watermelon%20banana&type=post
You can search for terms like "bruce lee" too, using "": search?q="bruce lee"&type=post
Resuming: " | " = OR " " and "+" = AND
I did not find a way to use the NOT operator
And I agree, it is the worst API documentation ever.
It seems, | is not working any more, I've just discovered it today. Only posts matching ALL words from query are found.
Only to share: 'POST' search will no longer be possible from April 30th 2015. See https://developers.facebook.com/docs/apps/upgrading#upgrading_v2_0_graph_api under the paragraph "Removed endpoints":
Public post search is no longer available. (/search?type=post&q=foobar)
Right now if you enter a number of words in the search term, separated by space - then you should get back relevant entities that have those words (anywhere in the entity, in any order). "bruce lee" --> "Bruce is a nice guy, he likes Lee" would be a possible result. There is no "or" operator that works.
I opened a case at Facebook, which was closed hours later for the reason it "works as specified" here: https://developers.facebook.com/x/bugs/138296099674000/
This is a bug tracking tool, but the details you added here don't represent a bug report - it appears to be you asking for assistance on how to make certain things work in the search API or a feature request for the search API to start supporting different operators - only the behaviours documented here are supported:https://developers.facebook.com/docs/reference/api/search/
Obviously I can't disagree with the correctness of this claim (especially given @tesserex and @vbNewbie 's observations above) BUT let's not give up.
Since I think we all agree the current functionality is limited / limiting, I would like to encourage all of the people that agree with me to open bug reports and / or feature requests (how do you open a feature req. for FB?) so that this will get prioritized correctly.
I don't think the current functionality does Facebook or the developers any good, and I don't think it should be a major effort for FB to improve it significantly.
So let's gently apply some pressure ;-)
It's not working like that anymore, but I'm finding that this will work now (for search for watermelon OR banana: http://graph.facebook.com/search?q=watermelon&q=banana&type=post
精彩评论