SearchTwitterDemo - language filter

Feb 1, 2010 at 6:26 PM

Tried to filter the search results using search.Language == "en" filter but no results were displayed. Search results are shown in output window when languge filter is removed, here is the query:

 string filter = "Dallas";
           
var queryResults =
  from search in twitterCtx.Search
    where search.Type == SearchType.Search &&
      search.Query == filter &&
      search.Language == "en"
  select search;

Any clues?

SS

Coordinator
Feb 2, 2010 at 5:09 AM

Hi SS,

You should use SearchLanguage instead.  Here's an example:

            var filter = "Dallas";

            var queryResult =
                (from search in twitterCtx.Search
                 where search.Type == SearchType.Search &&
                    search.Query == filter && 
                    search.SearchLanguage == "en"
                 select search)
                 .SingleOrDefault();

            foreach (var entry in queryResult.Entries)
            {
                Console.WriteLine(
                    "ID: {0}, Source: {1}, Language: {2}\nContent: {3}\n",
                    entry.ID, entry.Source, entry.Language, entry.Content);
            }

 It looks like all of my results are coming up "en", so I'm not absolutely sure it's working right.  Any advice on how to test this properly would be appreciated.

Joe