First N tweets that do not have StatusID in List<string>

Apr 30, 2013 at 11:54 PM
Edited Apr 30, 2013 at 11:58 PM
I was hoping to be able to select "the first N tweets that do not have StatusID in <List>" like I do in Entity Framework. I tried the code below but it does not appear to have an effect (the tweet with StatusID 329377395314393089 still appears):
var ignoreStatusID = new List<string>{ 
"329377395314393089"};

var srch =
    (from search in twitterCtx.Search
        where search.Type == SearchType.Search &&
            search.Query == "#f150"
            && search.IncludeEntities == true
            && search.Statuses.Any(s => !ignoreStatusID.Contains(s.StatusID))
            && search.Count == 5
        select search)
    .SingleOrDefault();
Maybe I messed up my .Any() (it wouldn't be the first time), or maybe there's another way to accomplish what I'm after?

If not, would I be correct in saying that my only alternative would be to drop any matching items after the query (in which case I'll select N*2 and trim to N afterwards...while hoping I don't have to re-select again if I trim too many)?
Coordinator
May 1, 2013 at 12:12 AM
The only valid operators on filter is equality, which sets the parameter to that value. We're querying a REST endpoint, so normal SQL doesn't apply here. You can visit the docs to see what filter parameters are available, which correspond to what the Twitter API exposes. With Search, you can include advanced operators as part of the Query. Also, Twitter Search doesn't work like a normal search engine, as they don't return some items. Sometimes it's useful to build your query with Twitter's Search to make sure you're getting what you want and then write the code.

For any filters that aren't available. Do a broader LINQ to Twitter search to get what you need and then do a LINQ to Objects query on the results that LINQ to Twitter pulls down for you.

@JoeMayo
May 1, 2013 at 3:16 PM
Cool, thanks. That was pretty much what i figured based on my limited knowledge of the Twitter API in the background...but i wanted to make sure.