Twitter search exact phrase query with Twitterkit on Android

android
fabric

#1

Hi every one!!

When I try to make a search query of tweets with an exact phrase like “it´s 23:12 and”, the amount of tweets that fetch the callback is lower (sometimes 0 tweets) that if I do the same query in https://twitter.com/search-home
I put the “” for searching exact phrase in the query parameter
Am I doing something wrong?

Code Example

TwitterCore.getInstance().logInGuest(new Callback<AppSession>() {
    @Override
    public void success(Result<AppSession> result) {

        TwitterApiClient twitterApiClient =  Twitter.getInstance().getApiClient();
        twitterApiClient.getSearchService().tweets("\"It´s 23:12 and\"", null, null, null, null, 50, null, null, null, false, new GuestCallback<>(new Callback<Search>() {
            @Override
            public void success(Result<Search> result) {
                // use result tweets
                int sizeResult = result.data.tweets.size();

            }

            @Override
            public void failure(TwitterException exception) {
                // handle exceptions


            }
        }));
    }

    @Override
    public void failure(TwitterException e) {
        int i = 0;
    }
});

In this case sizeResult is equal to 0

Thanks


#2

Unfortunately Search API only indexes last ~7 days or so, so all the results you see on the web aren’t available in the API. Doesn’t mean that your implementation is wrong though - try another query with more recent tweets to check.


#3

Ok, Thanks for the feedback!!