SinceID ignored on Search API

Jun 24, 2013 at 7:25 PM
Edited Jun 24, 2013 at 7:28 PM
My code is trying to paging a little different then your blog post "Working with Timelines with LINQ to Twitter" since your example is for the Status Context and mine is for using the Search Context
my sinceID = 0 so I query by sincedate instead for initial query
if (Test.SinceId == 0)
{
        FriendTweets = (from search in twitterCtx.Search  where search.Type == SearchType.Search && search.ResultType == ResultType.Recent &&  search.Query == "to:" + Test.TwitterHandle + " since:" + Date2                                                      && search.Count == 100 select search).SingleOrDefault();
}
else
{
      FriendTweets = (from search in twitterCtx.Search where search.Type == SearchType.Search && search.ResultType == ResultType.Recent && search.SinceID == (ulong)Test.SinceId && search.Query == "to:" + Test.TwitterHandle 
  && search.Count == 100   select search).SingleOrDefault();
}
Initially the SinceID is 0 so the first if condition is hit and that works fine and return 99 records since that is the limit in a query but since this is a do while loop I update the SinceID like so:
Test.SinceId = Convert.ToInt64(FriendTweets.Statuses[0].StatusID);
so the next test of if should run through the else condition which it does but it returns no records which it should. Am I doing my else condition wrong by using the SinceID that way?
Jun 24, 2013 at 10:39 PM
I realized what the problem is, the code above is returning the newest tweet oppose to iterating from the oldest tweet from the "since" Date. So basically I thought I could page backwards but its trying to page forward
Coordinator
Jun 24, 2013 at 10:47 PM
Good observation. I know it takes a little while to wrap your brain around it. You might want to check out the link to the Twitter explanation too because that also explains their rationale for the design. Essentially, it's because the timeline is continuously updating and this keeps you from losing tweets.

Also, StatusID #0 doesn't exist, so you might see strange errors from Twitter unless you set it to 1 or later.

@JoeMayo