Esri / twitter-for-geoevent

ArcGIS GeoEvent Server sample Twitter connectors for sending and receiving tweets.
Apache License 2.0
21 stars 12 forks source link

FilterQuery only allows one type of filter. #8

Open ClemsonGIS opened 7 years ago

ClemsonGIS commented 7 years ago

When creating a Twitter Input you can specify the following Filters: "Follow","Track", and "Locations". In the TwitterInbountTransport.java file the following code snippet only allows for one filter to be used.

> 
> FilterQuery fq = new FilterQuery();
> 
>           String keywords[] = tracks;
> 
>           if(follows != null && follows.length>0)
>               fq.follow(follows);
>           else if(keywords != null && keywords.length>0)
>               fq.track(keywords);
>           else if(locations != null)
>               fq.locations(locations);
>           else
>               throw new Exception("INBOUND_TRANSPORT_NOFILTER_ERROR");
>           
>           fq.count(count);

Is that intentional? I thought more than one filter was allowed? Shouldn't these checks be individual IF statements?

ie.

>                     boolean inFilterSpecified = false;            
> 
>           if(follows != null && follows.length>0) {
>               fq.follow(follows);
>               inFilterSpecified = true;
>         }
>           if(keywords != null && keywords.length>0) {
>               fq.track(keywords);
>               inFilterSpecified = true;
>           }
>           if(locations != null) {
>               fq.locations(locations);
>               inFilterSpecified = true;
>           }
>           if (!inFilterSpecified)
>               throw new Exception("INBOUND_TRANSPORT_NOFILTER_ERROR");
mzesri commented 7 years ago

My understanding is that when you specify follow, track and location filters, they are not applied on top of each other. In other words, they are an "OR" type of relation, not "AND" type of relation. See this documentation here https://dev.twitter.com/streaming/reference/post/statuses/filter. So, the use case for specifying different types of filters simultaneously is very limited. That is probably why the connector only supports one filter at a time.

ClemsonGIS commented 7 years ago

Even if it is an OR operator that combines the predicate parameters, the code should allow you to use more than one field. As it stands, the code currently in there doesn't allow that.

Thanks for listening, Patrick

Though from looking at the site it does seem to support more On 10/11/2016 1:25 PM, Ming Zhao wrote:

My understanding is that when you specify follow, track and location filters, they are not applied on top of each other. In other words, they are an "OR" type of relation, not "AND" type of relation. See this documentation here https://dev.twitter.com/streaming/reference/post/statuses/filter https://urldefense.proofpoint.com/v2/url?u=https-3A__dev.twitter.com_streaming_reference_post_statuses_filter&d=CwMFaQ&c=Ngd-ta5yRYsqeUsEDgxhcqsYYY1Xs5ogLxWPA_2Wlc4&r=ZnwTT5r1poLYiHcxL8Afbw&m=dT08NDDMcQeuRUBi5Blq8Fdz9O_MikmUA6-EQl-YzIQ&s=z5InPQ5FCfJ-nlZ4uxr8fBNHIz3mYrOFbMnmOjv_CHk&e=. So, the use case for specifying different types of filters simultaneously is very limited. That is probably why the connector only supports one filter at a time.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_Esri_twitter-2Dfor-2Dgeoevent_issues_8-23issuecomment-2D252985211&d=CwMFaQ&c=Ngd-ta5yRYsqeUsEDgxhcqsYYY1Xs5ogLxWPA_2Wlc4&r=ZnwTT5r1poLYiHcxL8Afbw&m=dT08NDDMcQeuRUBi5Blq8Fdz9O_MikmUA6-EQl-YzIQ&s=pdgyfITFJhhC_7JxywGXZpqVDUsRUIagfG2yB_ykZmI&e=, or mute the thread https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_notifications_unsubscribe-2Dauth_ATtchfDH3EjGr0GxW7vUA0kNyJ7FcjmSks5qy8ZsgaJpZM4KTseP&d=CwMFaQ&c=Ngd-ta5yRYsqeUsEDgxhcqsYYY1Xs5ogLxWPA_2Wlc4&r=ZnwTT5r1poLYiHcxL8Afbw&m=dT08NDDMcQeuRUBi5Blq8Fdz9O_MikmUA6-EQl-YzIQ&s=EWi24Rt8n5E5aTktSIu4MNfSHYakoYPcrdzRnO-7gLA&e=.

/Patrick Claflin GIS Sys Admin/Developer Clemson University (CCGT) (864) 656-7462 pat@g.clemson.edu /