Announcement Announcement Module
Collapse
No announcement yet.
Searching the Facebook graph Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Searching the Facebook graph

    I am new to Spring Social. I am looking for a Facebook operation that performs a graph search (for example https://graph.facebook.com/search?q=platform&type=page) but can't seem to find one. Is it possible that this feature is not supported in Spring Social?

  • #2
    To narrow the question, I am looking for a page search option, but I don't see that there is a search method defined for it like in other operations such as users, groups and events. Why is there a difference for pages? Do I need to implement that myself or is it found somewhere else?

    Comment


    • #3
      Good question. it's likely a matter of page search being overlooked. I'll look into it and see about adding one. In the meantime, you could do it yourself via the RestOperations object given by Facebook.restOperations(). Or better yet, since the Facebook interface extends the GraphApi interface, you can simply do something like this:

      Code:
      MultiValueMap<String, String> queryMap = new LinkedMultiValueMap<String, String>();
      queryMap.add("q", query);
      queryMap.add("type", "page");
      List<Reference> pages = graphApi.fetchConnections("search", null, Reference.class, queryMap);
      Which is essentially the code I'd put in such a page search method.

      Comment


      • #4
        Note that the one thing that is slightly different here is that Facebook returns an id, name, and category for pages, whereas other search return just the id and name. Thus, a Reference object is appropriate for all search types, but you won't capture the category if you use Reference. I'd probably create a PageReference or some such thing that extends Reference, but captures the category.

        Comment


        • #5
          Thanks for the tip. I did use facebook.fetchConnections(..) to implement that. I think there are other objects that don't have a search option too.

          Comment


          • #6
            I wouldn't be surprised if other objects were overlooked. When I wrote the search stuff, Facebook's documentation was rather slim and so I developed just enough to cover what I knew about. Since then, the Facebook platform team has completely updated their documentation, uncovering things that previously weren't documented. I'll add a TODO item to go back and review what Facebook search can do and update the API binding accordingly.

            Comment

            Working...
            X