• Home /
  • Sources /
  • Disqus /
  • Disqus PowerTrack Operators
  • Disqus PowerTrack Operators


    The following operators are available to filter the Disqus firehose via PowerTrack. These operators will match specific characteristics of Disqus activities, and can be combined using standard PowerTrack syntax.

    Operator Description

    keyword

    Matches a keyword within the body of an activity. This is a tokenized match, meaning that your keyword string will be matched against the tokenized text of the activity body – tokenization is based on punctuation, symbol, and separator Unicode basic plane characters. For example, an activity with the text “I like coca-cola” would be split into the following tokens: I, like, coca, cola. These tokens would then be compared to the keyword string used in your rule. To match strings containing punctuation (e.g. coca-cola), symbol, or separator characters, you must use a quoted exact match as described below.

    Gnip Rule Match No Match
    gnip I need to call gnip
    Check out gnip's documentation.
    I love the @gnip blog.
    Check out Gnip.
    #gniprocks
    cola Ice cold cola on a hot day
    I like coca-cola!
    I like cocacola!
    snow please let it snow!

    twitter_entities.urls.display_url: https://en.wikipedia.org/wiki/Snow

    gnip.urls.expanded_url: http://www.snowdays.com/2015/01/how-to-get-more-snow-days/
    it is finally snowing!
    Coachella Hanging out at #coachella NEW.PICS.FROM.COACHELLA2015!



    See Examples

    "exact phrase match"

    Matches an exact phrase within the body of an activity. This is an exact match, and it is not necessary to escape characters with a backslash. For example, if matching something with a slash, use “one/two”, not “one\/two”.

    Note that this is not a substring match, and includes a check for word boundaries at the ends of the quoted phrase. For a pure substring match, see the contains: operator below.

    Gnip Rule Match No Match
    "call gnip" I need to call gnip, again
    I need to call gnip again
    call gnip
    I called gnip
    call gnip (multiple spaces)
    call-gnip
    call_gnip
    "one/two" Maybe we can look at one/two different computers
    One/two/three - fourth time's is a charm
    call gnip
    #one/two hashtags with punctuation don't work well
    one//two slash happy
    one\two



    See Examples

    "keyword1 keyword2"~N

    Commonly referred to as a proximity operator, this matches an activity where the keywords are no more than N tokens from each other.

    If the keywords are in the opposite order, they can not be more than N-2 tokens from each other.

    Can have any number of keywords in quotes.

    N cannot be greater than 6.

    Gnip Rule Match No Match
    "love boulder"~4 Love everything about my town Boulder.
    Boulder, I love living here.
    I don’t love hiking, but I really like to visit Boulder.
    Boulder is a place I love to visit.



    See Examples

    contains:

    Substring match for activities that have the given substring in the body, regardless of tokenization. In other words, this does a pure substring match, and does not consider word boundaries.

    Use double quotes to match substrings that contain whitespace or punctuation.

    Gnip Rule Match No Match
    contains:phone Where is my phone?
    That's a telephone
    Pongo la telephono.
    What is the ph0ne number?
    contains:"$TWTR" How much is $TWTR stock?
    How much is $TWTRstock?
    Headlines with $GOOG$TWTR$FB today
    Just setting up my TWTR Just setting up my $ TWTR



    See Examples

    from:

    Matches any activity from a specific user.

    In Twitter, the value must be the user’s Twitter Account ID or username (excluding the @ character). See HERE or HERE for methods for looking up numeric Twitter Account IDs.

    For some publishers, MD5-hashed email can be used.

    Gnip Rule Match No Match
    from:17200003 All original tweets from user 1720003
    Retweets of others' tweets by user 1720003
    Replies made by user 1720003 on others' tweets
    Tweets from this user 1720003, regardless of user's changed username
    Retweets of user 1720003 tweets by other users
    from:mikesmith All original tweets from user mikesmith
    Retweets of others' tweets by mikesmith
    Retweets of mikesmith tweets by other users
    Tweets from this user, with a different or changed username



    See Examples

    url_contains:

    Matches activities with URLs that literally contain the given phrase or keyword. To search for patterns with punctuation in them (i.e. google.com) enclose the search term in quotes.

    NOTE: If you’re using Gnip’s Enriched output format, we will match against Gnip’s expanded URL as well.

    Gnip Rule Match No Match
    url_contains:gnip http://support.gnip.com/
    https://github.com/abh1nav/gnippy
    https://gn.ip.com
    url_contains:"how-to" https://www.coachella.com/how-to-purchase/  
    url_contains:teslas twitter_entities.urls.url: http://t.co/yECAbi9p6Q twitter_entities.urls.expanded_url: http://wrd.cm/1IfohKo gnip.urls.display_url: wrd.cm/1IfohKo gnip.urls.expanded_url: http://www.wired.com/2015/05/used-teslas/ (matches fully unwound URL)  



    See Examples

    has:links

    This operators matches activities which contain links in the message body.

    Gnip Rule Match No Match
    cat has:links Here's a picture of my cat: bit.ly/cat
    Adopt a cat at http://spca.org/cats
    Check out @gnip
    Check out #gnip



    See Examples

    lang:

    Matches activities that have been classified by Gnip as being of a particular language (if, and only if, the activity has been classified). Current languages supported are:

    • ar - Arabic
    • da - Danish
    • de - German
    • el - Greek
    • en - English
    • es - Spanish
    • fa - Persian
    • fi - Finnish
    • fr - French
    • he - Hebrew
    • it - Italian
    • id - Indonesian
    • ja - Japanese
    • ko - Korean
    • nl - Dutch
    • no - Norwegian
    • pl - Polish
    • pt - Portuguese
    • ru - Russian
    • sv - Swedish
    • th - Thai
    • tr - Turkish
    • uk - Ukrainian
    • zh - Chinese

    It is important to note that each activity is currently only classified as being of one language, so AND’ing together multiple languages will yield no results. Also note that not every activity is classified as being of a particular language.

    Gnip Rule Match No Match
    lang:de Guten Morgen! Good morning!
    cat lang:en I'm taking my cat to prom I'm taking my dog to prom



    See Examples

    has:lang

    Matches activities which Gnip has classified as any language.

    Gnip Rule Match No Match
    has:lang gnip.language.value: es gnip.language.value: null
    twitter_lang:es (but gnip.language.value: null)



    See Examples

    sample:

    Returns a random sample of activities that match a rule rather than the entire set of activities. Sample percent must be represented by an integer value between 1 and 100. This operator applies to the entire rule and requires any “OR’d” terms be grouped.

    Important Note: The sample operator first reduces the scope of the firehose to X%, which then the rest of the rule is applied to. Each Tweet individually (of all tweets) has a 10% chance of being in a 10% sample, or 1%chance:1%sample, 50%chance:50%sample, etc. The sample is applied before the rule is applied to the sample.

    Also, the sampling is deterministic, and you will get the same data sample in realtime as you would if you pulled the data historically.

    Gnip Rule Match No Match
    dog sample:50 All of the Tweets matching the keyword dog within the 50% firehose sample.  
    (dog OR cat) sample:25 All of the Tweets matching the keyword cat or the keyword dog within the 25% firehose sample.  
    sample:2 2% of all tweets (Note:This is a stand alone rule for 1-10% sample)  



    See Examples

    verb:post

    Matches activities where a new comment has been created.

    verb:update

    Matches activities where a previously created comment has been updated.

    verb:delete

    Matches activities where a previously created comment has been deleted.

    thread_url_contains:

    Matches activities posted to a web page that’s URL contains the given phrase or keyword. URL encodings are not encoded at this time. To search for patterns with punctuation in them (i.e. google.com) enclose the search term in quotes.

    Gnip Rule Match
    thread_url_contains:"cnn.com" All activities posted to cnn.com
    thread_url_contains:"obama" All activities posted to a web page with "obama" in the URL



    See Examples