Streaming with Location AND ((track 1) OR (track 2)), possible?

Mar 9, 2015 at 1:25 AM
Hi,

I am trying to capture some tweets from a region and at the same time, I would like to have at least two tracks with an OR between them like this
        var topLeft = Geo.GenerateCoordinates(..., ...);
        var bottomRight = Geo.GenerateCoordinates(..., ...);

        StreamWriter sw = new StreamWriter(outputStreamFile);
        var filteredStream = Tweetinvi.Stream.CreateFilteredStream();
        filteredStream.AddTrack("query term 1");
        filteredStream.AddTrack("query term 2");
        filteredStream.AddLocation(topLeft, bottomRight);

        filteredStream.MatchingTweetReceived += (sender, args) =>
                    {
                        Console.WriteLine(getTweetJSONObject(args.Tweet));
                        sw.WriteLine(getTweetJSONObject(args.Tweet));

                        sw.Flush();
                    };
        filteredStream.StartStreamMatchingAllConditionsAsync();
    }
However, it seems like I only have two options:

1- StartStreamMatchingAllConditionsAsync: which includes Location with AND between tracks.
2- StartStreamMatchingAnyConditionAsync: which has OR between tracks; however, it may or may not consider Location because it is part of the Any conditions instead of being treated separately.

I have tried MatchingTweetAndLocationReceived as well and seen the same behaviour.

Any ideas?

Thanks,
Coordinator
Mar 10, 2015 at 1:27 AM
Hi,

This code will get all the tweets containing ( (keyword1 AND keyword2) OR (keyword3) ) AND (Matching the expected location)
var filteredStream = Tweetinvi.Stream.CreateFilteredStream();
filteredStream.AddTrack("keyword1 keyword2");
filteredStream.AddTrack("keyword3");
filteredStream.AddLocation(topLeft, bottomRight);

filteredStream.StartStreamMatchingAllConditionsAsync();
As a result your code should be working fined.
Marked as answer by linvi on 3/9/2015 at 6:27 PM