Boolean Logic and Syntax
Scraawl SocL’s Premium Advanced Search rules for Twitter deliver matching data to you based on search rules that you set up.
Keywords are not case sensitive.
Search Rules | Sample Matching Posts |
---|---|
happy Happy | I am very happy today. I am very happy today. |
Find multiple keywords in the same post.
Search Rules | Sample Matching Posts |
---|---|
happy AND party happy party | I'm very happy since I'm having a party. |
Find any one of several keywords (or both).
Search Rules | Sample Matching Posts |
---|---|
happy OR party | I'm very happy. I'm having a party tonight. I'm very happy since I'm having a party. |
NOTs should always follow an AND because a negated term by itself will result in a HUGE volume search.
Search Rules | Sample Matching Posts |
---|---|
happy AND NOT birthday happy -birthday | I am happy to see you. Sunflowers make me happy. |
Logical clauses can be combined using parentheses to create more complex searches
Search Rules | Sample Matching Posts |
---|---|
(happy OR party) AND (holiday OR house) (happy OR party) (holiday OR house) | We always have a party for the Thanksgiving holiday. |
To exclude multiple terms from your search, negate an OR statement.
Search Rules | Sample Matching Post |
---|---|
happy AND NOT (party OR holiday) happy -(party OR holiday) | Happy birthday! |
NOTE: Negations should always follow an AND. Negations following an OR would return everything except the negation. E.g., this is an invalid search: ipad OR -(iphone OR ipod)
Quotes (“”) allow you to search for an exact phrase (which is not case sensitive).
Search Rules | Sample Matching Posts |
---|---|
"happy birthday" | Happy birthday! |
Order of Operations
When combining AND and OR functionality in a single rule, the following order of operations will dictate how your rule is evaluated.
- Operators connected by AND logic are combined first
- Then, operators connected with OR logic are applied
Search Rules | Sample Matching Posts |
---|---|
iphone OR ipad AND apple = iphone OR (ipad AND apple) | I own an apple ipad. |
apple OR iphone ipad = apple OR (iphone AND ipad) | My grandma has an iphone and an ipad. |
ipad AND iphone OR android = (iphone ipad) OR android | Who has an ipad and not an iphone? |
To eliminate uncertainty and ensure that your rules are evaluated as intended, group terms together with parentheses where appropriate. For example:
Search Rules | Sample Matching Posts |
---|---|
iphone –(ipad OR android) | I can’t live without my iphone. |
(iphone OR ipad) AND apple | He needs to fix his iphone at the apple store. |
ipad -(iphone OR android) | I read books on my ipad. |
Operators
Below is a list of all operators supported in Twitter Advanced Search.
Logic Type | Scraawl Syntax | Description |
---|---|---|
from: | from:username | Matches any activity from a specific user. |
to: | to:scraawl | Matches any activity that is in reply to a particular user. |
has:links | cat has:links | The operators matches activities which contain links in the message body. |
lang | lang:zh | Matches posts that have been classified by posts source as being of a particular language (if, and only if, the post has been classified). It is important to note that each post is currently only classified as being of one language, so AND’ing together multiple languages will yield no results. |
# | #hongkongprotests | Matches any activity with the given hashtag. |
point_radius: [lon lat radius] | point_radius:[-77.0365 38.8977 10mi] lang:en | Matches against the Exact Location (x,y) of the post when present, or against the location of a geo-profiled place identified in the text, and where the geo-profiled place is fully contained within the defined region. |
@ | @scraawl | Matches any tweet that mentions the given username. |
place: | "New York City" | Matches tweets tagged with the specified location. |
has:media | has:media | Matches tweets that contain a media url classified by Twitter. |