Help paging through search results

Nov 2, 2012 at 10:29 AM
Edited Nov 2, 2012 at 10:36 AM

Hello,

I'm having problems paging through Twitter search results. I have the following code (from (http://geekswithblogs.net/WinAZ/archive/2012/09/02/working-with-timelines-with-linq-to-twitter.aspx): 

            var statusList = new List<Status>();

            var searchResult =
                (
                    from search in _twitterContext.Search
                    where search.Type == SearchType.Search &&
                          search.Query == query &&
                          search.Count == 100
                    select search
                ).SingleOrDefault();

            statusList.AddRange(searchResult.Statuses.ToList());

            // first tweet processed on current query
            var maxId = searchResult.Statuses.Min(
                status => ulong.Parse(status.StatusID)) - 1;

            do
            {
                  searchResult =
                    (
                        from search in _twitterContext.Search
                        where search.Type == SearchType.Search &&
                              search.Query == query &&
                              search.MaxID == maxId &&
                              search.Count == 100
                        select search
                    ).SingleOrDefault();

                if (searchResult != null && searchResult.Statuses.Count > 0)
                {
                    // first tweet processed on current query
                    maxId = searchResult.Statuses.Min(
                        status => ulong.Parse(status.StatusID)) - 1;

                    statusList.AddRange(searchResult.Statuses.ToList());
                }
            }
            while (searchResult != null && 
                (searchResult.Statuses.Count != 0 || statusList.Count > 500));

The first search request returns a response, however, the request inside the loop always returns null.  I can see that the request was sent by inspecting the RawResult property in the TwitterContext, however, it appears it's not being deserialised into the Search property.
I am doing anything wrong here?
Also, i'm using the latest version LinqToTwitter, compiled from source.
Thank you
Coordinator
Nov 2, 2012 at 12:09 PM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.
Coordinator
Nov 2, 2012 at 12:10 PM

Hi,

I found a bug and copied to a work item. Thanks for letting me know.

Joe