Hello,
It seems there is a bug in:
max_id: Returns results with an ID less than (that is, older than) or equal to the specified ID.
That means that it'll repeat the max_id.
Particularly bad is when i search for a term that's rare (e.g. #kasper) => it returns only 40 results or so. Then it loops until exhausting the search quota (as the "if" statement never gets triggered => it'll always return the last 1 result)...
Thanks,
C
It seems there is a bug in:
while (result.Count < tweetSearchParameters.MaximumNumberOfResults)
{
if (currentResult.IsEmpty())
{
// If Twitter does not any result left, stop the search
break;
}
var oldestTweetId = _tweetHelper.GetOldestTweetId(currentResult);
searchParameter.MaxId = oldestTweetId;
searchParameter.MaximumNumberOfResults = Math.Min(tweetSearchParameters.MaximumNumberOfResults - result.Count, 100);
query = _searchQueryGenerator.GetSearchTweetsQuery(searchParameter);
currentResult = GetTweetDTOsFromSearch(query);
result.AddRange(currentResult);
}
I believe it needs to be: searchParameter.MaxId = oldestTweetId - 1;
The reason being that the documentation https://dev.twitter.com/docs/api/1.1/get/search/tweets says:max_id: Returns results with an ID less than (that is, older than) or equal to the specified ID.
That means that it'll repeat the max_id.
Particularly bad is when i search for a term that's rare (e.g. #kasper) => it returns only 40 results or so. Then it loops until exhausting the search quota (as the "if" statement never gets triggered => it'll always return the last 1 result)...
Thanks,
C