Mixed ANDs and ORs

Apr 6, 2014 at 8:15 AM
Edited Apr 6, 2014 at 8:16 AM
Hi Linivi,

Using your fantastic library how to do something like this
  Hi Twitter I need to track "Word1 and Word2" Or "Word3 And Word4" __in one stream__
Coordinator
Apr 7, 2014 at 12:43 AM
Hi,

To add an AND condition you need to add a space between your keywords.
var fs = Stream.CreateFilteredStream();
fs.AddTrack("word1 word2");
fs.AddTrack("word3 word4");
fs.MatchingTweetReceived += (sender, args) =>
{
    var matchingTrack = args.MatchingTracks.First();
    Console.WriteLine(args.Tweet.Text);
};
fs.StartStreamMatchingAllConditions();
Please note that twitter allows up to 60 characters per track (space included).

Hope this helps.
Linvi
Apr 13, 2014 at 10:43 AM
Hi linvi,

unfortunately this will not solve my question because of this DoestTheTweetMatchAllConditions

I don't want the tweet to have "word1 and word2" and also "word3 and word4" at the same time

so please can you translate this to English "may be I miss something"
var fs = Stream.CreateFilteredStream();
fs.AddTrack("word1 word2");
fs.AddTrack("word3 word4");
fs.AddTrack("word5");
fs.AddTrack("word6");
fs.MatchingTweetReceived += (sender, args) =>
{
    var matchingTrack = args.MatchingTracks.First();
    Console.WriteLine(args.Tweet.Text);
};
fs.StartStreamMatchingAllConditions();
Coordinator
Apr 14, 2014 at 11:44 PM
Hi,

I am not really sure what you want to do here.
If you want to have tweets received do special operations based on the track you can use the second parameter of AddTrack.
var fs = Stream.CreateFilteredStream();
fs.AddTrack("word1 word2", tweet =>
{
    // Do something with the tweet that match word1 and word2
});
fs.AddTrack("word3 word4", tweet =>
{
    // Do something with the tweet that match word3 and word4
});
Am I responding to your problem?
Linvi
Marked as answer by linvi on 4/15/2014 at 11:46 AM
Apr 15, 2014 at 7:46 AM
Yes , I think this will solve my problem :)
at the end Thank you in all cases