Search limit

Aug 9, 2014 at 10:49 AM
Edited Aug 9, 2014 at 10:50 AM
Looking through the code, the search API limits the number of search results pulled in one request to 100 and then loops to make the requested number (from Tweetinvi.Controllers.Search.SearchQueryExecutor):
while (list.Count < tweetSearchParameters.MaximumNumberOfResults && !IEnumerableExtension.IsEmpty<ITweetDTO>((IEnumerable<ITweetDTO>) tweetDtOsFromSearch))
      {
        long oldestTweetId = this._tweetHelper.GetOldestTweetId((IEnumerable<ITweetDTO>) tweetDtOsFromSearch);
        tweetSearchParameters1.MaxId = oldestTweetId;
        tweetSearchParameters1.MaximumNumberOfResults = Math.Min(tweetSearchParameters.MaximumNumberOfResults - list.Count, 100);
        tweetDtOsFromSearch = this.GetTweetDTOsFromSearch(this._searchQueryGenerator.GetSearchTweetsQuery(tweetSearchParameters1));
        list.AddRange((IEnumerable<ITweetDTO>) tweetDtOsFromSearch);
      }
This causes the problem that for large searches you hit Twitters rate limit for requests. Why is the number of search results here limited to 100?

Thanks

Mike
Coordinator
Aug 9, 2014 at 5:16 PM
Hi there,

It is limited to 100 because Twitter limits it to 100. I am also very unhappy with this decision but there is no way to get more than 100 tweets in a request.
Concerning the rate limit, you are not the first one to ask, and this will be added in the coming release. There is already a work item for this.

Linvi
Aug 9, 2014 at 5:37 PM

I thought that might be the problem. Do you have any recommendations on methods to get around this?

Mike

Coordinator
Aug 9, 2014 at 6:06 PM
Edited Aug 11, 2014 at 9:45 AM
My recommendation is to not use the search at all.

Twitter Search API has many many problems. I usually use the FilteredStream which gives you more results than the Search and does not have any rate limit.

Linvi