Demirhan Aydin
Demirhan Aydin

Reputation: 51

How to use keywords include ampersand(&) in Facebook Search API

I want to use some keywords that include special characters like & in Facebook search api. I tried the query below but I cannot get useful results. Is there any chance for this usage in search api? How should I build my search query?

My example queries and keywords are "H&M", "marks & spencer", http://graph.facebook.com/search?type=post&limit=25&q="H&M" http://graph.facebook.com/search?type=post&limit=25&q="marks & spencer"

Upvotes: 0

Views: 2571

Answers (3)

aklapcin
aklapcin

Reputation: 283

It seems, that all of solutions suggested here are not working any more.

Searching for q=H%26%bM returns empty data set. The same for q=H%26M.

It must have changed recently, in last 2 months.

If you try to search for postings about H&M on Facebook site (type H&M in search, then "Show me more results" on the bottom of list and then public posts on menu on the left side) the list is empty.

The only query that returns any results is q=H&M but it is not helpful, as the results are irrelevant for that query.

Upvotes: 0

LostInQuery
LostInQuery

Reputation: 519

My team worked on this forever, ended up finding this as a solution that provides relevant results for a query with an ampersand, such as 'H&M'.

%26amp%3b

This is the hex equivilent to &

So your example link would be

http://graph.facebook.com/search?type=post&limit=25&q="H%26amp%3bM"

We found the solution thanks to Creative Jar

Upvotes: 4

James Hay
James Hay

Reputation: 7325

You want %26 which is the URL encode for ampersand so

http://graph.facebook.com/search?type=post&limit=25&q="H%26M" http://graph.facebook.com/search?type=post&limit=25&q="marks %26 spencer"

Depending on your language, it may have a URL encoding function or you can just use string replacement.

Upvotes: 1

Related Questions