Count of Items returned in search

Feb 4, 2015 at 4:28 PM
I am sure I am just missing something, but lets say I wanted to query a search term for example a trending topic to see how many occurrences in the past 24 hours. Is there a quick way to get the count back? I am sure I am missing something but have researched myself into a dead end.

Thanks
Coordinator
Feb 4, 2015 at 6:29 PM
Hi,

There isn't a quick built-in way to get the number of tweets. Remember that then underlying data source is a REST API, which just returns a pre-defined set of results. That is much different than the rich query capabilities of a relational database. That said, I don't know if it's sufficient for your needs, but here's how you can figure out the number of tweets.
  1. Create an empty collection (List<Status>) to hold all tweets - I'll call it allTweets.
  2. Perform the query and put the results into allTweets.
  3. Continue querying (and populating allTweets) until the CreatedAt date of a tweet indicates that you're at 24-hours from start.
  4. Now the collection at #1 holds all the tweets. Call allTweets.Count() to get the number.
@JoeMayo