Search code examples
javafacebook-graph-apirestfb

RESTFB returning very few pubilc posts


I'm using restFB and trying to search public posts which contain the keyword I desire. For the following code, that keyword is "flu":

public class JavaApplication3 {    
    public static void main(String[] args) {
        FacebookClient facebookClient = new DefaultFacebookClient("ACCESS TOKEN");
        Connection<Post> publicSearch = facebookClient.fetchConnection(
            "search", Post.class,
            Parameter.with("q", "flu"), Parameter.with("type", "post")
        );
        int size=publicSearch.getData().size();
        for(int i=0;i<size;i++){
            System.out.println("Message: " + publicSearch.getData().get(i).getMessage());   
        }
    }
}

But this code returns very few posts, just 3-4. Same is the case with every keyword. Atmost it returns 25 posts. that's it. Is there another way?


Solution

  • You Should use https://graph.facebook.com/search?q=QUERY&type=OBJECT_TYPE instead for the following Problemm