This project has moved and is read-only. For the latest updates, please go here.

Missing results in search

Oct 7, 2011 at 2:13 PM


I am having trouble with search, it is not returning all the results. 

string hashTag = "#Linq2TwitterIsSweet";

var twitterCtx = new TwitterContext();
				      .Where(search => search.Type == SearchType.Search &&
                                        	       search.Query == hashTag &&
                                                       search.SinceID == sinceId)
                                queryResults =>
                                    if (queryResults.Count() == 0) 
                                        var tweets = new List<ITweet>();
                                                    .DoForEach(e => tweets.Add(TwitterModelMapper.CreateTweet(e))); // DoForEach -> custom extension method


I first post a few tweets containing "#Linq2TwitterIsSweet" and then preform the search (without the SinceID), and I find my tweets. However, if I do another post and search again, my new tweet is not found. What is strange is that queryResults[0].base.Refresh =<Id of last tweet>&q=<search term i was looking for>. And if I go to the Refresh URL with a browsers, I am able to find my new tweet, but  queryResults[0].base.Entries.Count is equal to 0.

I have tired the search with search.HasTag = "Linq2TwitterIsSweet", with search.ShowUser and various combinations. I have also tired to use the same TwitterContext that I post the new tweet with.


Any ideas what is going on??

Oct 7, 2011 at 9:02 PM


I've looked at this a couple times and nothing is jumping out as a potential problem.  I'll have to try to reproduce.  Don't have time right now, but will try to take a look this weekend.


Oct 10, 2011 at 5:48 AM


I can't reproduce.  I used nearly the same code as above, except my AsyncCallback was different.  Here are a few suggestions:

  1. You'll need to wrap the AsyncCallback contents in a Dispatcher.BeginInvoke - otherwise, you'll end up with a cross thread access error.
  2. Is there any chance that your code is changing sinceID?
  3. View Fiddler results and compare first query that returns values with second query that doesn't.
  4. Try ChangeSet 92759, which is the most recent good source code check-in (this is what I'm trying to repro with).


Oct 11, 2011 at 8:19 PM


I finally figured out what the problem was. In the actual code, I wrapped the creation of the twitterContext in a "using". I think my app would execute the method again before the old twitterContext was done disposing.

Once I removed the "using", everything worked fine.

Oct 11, 2011 at 8:47 PM

Ah, nice tip - thanks for following up.