論理演算子
- AND: 複数の検索条件を同時に満たす条件を作る
- OR: 複数の検索条件のいずれかを満たす条件を作る
- NOT: 検索条件を反転させる
- () Grouping: 複数の検索条件をグルーピングできる
演算子
-
Type:
- Standalone: 単独で使うことが可能
- Conjunction required: 単独でクエリに使用することはできず、Standaloneな演算子と同時に使用する必要がある。
-
Availability:
- Core
- Advanced
keyword:
- Type: Standalone
- Availability: Core ツイート本文に含まれるキーワードにマッチします。 トークン化マッチで、キーワード文字列とツイート本文のトークン化されたテキストがマッチングされます。 トークン化は、句読点、記号等で行われます。
キーワードで検索する場合は、二重引用符で囲む必要があります。
pepsi OR cola OR "coca cola"
emoji:
- Type: Standalone
- Availability: Core ツイート本文に含まれる絵文字にマッチします。キーワードと同様に、絵文字はトークン化されてマッチします。つまり、絵文字はツイート本文のテキストをトークン化したものとマッチします。 絵文字にバリアントがある場合は、ダブルクォートで囲んでクエリに追加する必要があることに注意してください。
(😃 OR 😡) 😬
"exact phrase match":
- Type: Standalone
-
Availability: Core ツイート本文に含まれるフレーズと完全に一致します。
("Twitter API" OR #v2) -"recent search"
### #
- Type: Standalone
- Availability: Core
ツイート内のハッシュタグを含むツイートにマッチします。
つまり、#hogeというルールは、#hogeというハッシュタグを含む投稿にはマッチしますが、#hogefugaというハッシュタグを含む投稿にはマッチしない、ということです。
hoge #hogefuga OR @YonaDeveloper
### @:
- Type: Standalone
- Availability: Core
指定されたユーザー名について言及しているツイートで、ユーザー名が認識可能なもの(@を含む)であれば、それにマッチします。
(@twitterdev OR @twitterapi) -@twitter
### $:
- Type: Standalone
- Availability: Advanced
指定した 'キャッシュタグ' (トークンの先頭は '$' 文字) を含むすべてのツイートとマッチします。
キャッシュタグ演算子は、本文からキャッシュタグを抽出するのではなく、Twitterの'symbols'エンティティ抽出に依存していることに注意しましょう。
$twtr OR @twitterdev -$fb
### from:
- Type: Standalone
- Availability: Core
Matches any Tweet from a specific user.
The value can be either the username (excluding the @ character) or the user’s numeric user ID.
You can only pass a single username/ID per from: operator.
Example: from:twitterdev OR from:twitterapi -from:twitter
### to:
- Type: Standalone
- Availability: Core
Matches any Tweet that is in reply to a particular user.
The value can be either the username (excluding the @ character) or the user’s numeric user ID.
You can only pass a single username/ID per to: operator.
Example: to:twitterdev OR to:twitterapi -to:twitter
### url:
- Type: Standalone
- Availability: Core
Performs a tokenized match on any validly-formatted URL of a Tweet.
This operator can matches on the contents of both the url or expanded_url fields. For example, a Tweet containing "You should check out Twitter Developer Labs: https://t.co/c0A36SWil4" (with the short URL redirecting to https://developer.twitter.com) will match both the following rules:
from:TwitterDev url:"https://developer.twitter.com"
(because it will match the contents of entities.urls.expanded_url)
from:TwitterDev url:"https://t.co"
(because it will match the contents of entities.urls.url)
Tokens and phrases containing punctuation or special characters should be double-quoted (for example, url:"/developer"). Similarly, to match on a specific protocol, enclose in double-quotes (for example, url:"https://developer.twitter.com").
### retweets_of:
- Type: Standalone
- Availability: Core
Matches Tweets that are Retweets of the specified user. The value can be either the username (excluding the @ character) or the user’s numeric user ID.
You can only pass a single username/ID per retweets_of: operator.
Example: retweets_of:twitterdev OR retweets_of:twitterapi
### context:
- Type: Standalone
- Availability: Core
Matches Tweets with a specific domain id/enitity id pair. To learn more about this operator, please visit our page on annotations.
You can only pass a single domain/entity per context: operator.
context:domain_id.entity_id
However, you can combine multiple domain/entities using the OR operator:
(context:47.1139229372198469633 OR context:11.1088514520308342784)
Examples:
context:10.799022225751871488
(domain_id.entity_id returns Tweets matching that specific domain-entity pair)
### entity:
- Type: Standalone
- Availability: Core
Matches Tweets with a specific entity string value. To learn more about this operator, please visit our page on annotations.
Please note that this is only available with recent search.
You can only pass a single entity: operator.
entity:"string declaration of entity/place"
Examples: entity:"Michael Jordan" OR entity:"Barcelona"
### conversation_id:
- Type: Standalone
- Availability: Core
Matches Tweets that share a common conversation ID. A conversation ID is set to the Tweet ID of a Tweet that started a conversation. As Replies to a Tweet are posted, even Replies to Replies, the conversation_id is added to its JSON payload.
You can only pass a single conversation ID per conversation_id: operator.
Example: conversation_id:1334987486343299072 (from:twitterdev OR from:twitterapi)
### list:
- Type: Standalone
- Availability: Advanced
NEW Matches Tweets posted by users who are members of a specified list.
For example, if @twitterdev and @twitterapi were members of List 123, and you included list:123 in your query, your response will only contain Tweets that have been published by those accounts. You can find List IDs by using the List lookup endpoint.
Please note that you can only use a single list: operator per query, and you can only specify a single List per list: operator.
Example: list:123
### place:
- Type: Standalone
- Availability: Advanced
Matches Tweets tagged with the specified location or Twitter place ID. Multi-word place names (“New York City”, “Palo Alto”) should be enclosed in quotes.
You can only pass a single place per place: operator.
Note: See the GET geo/search standard v1.1 endpoint for how to obtain Twitter place IDs.
Note: This operator will not match on Retweets, since Retweet's places are attached to the original Tweet. It will also not match on places attached to the original Tweet of a Quote Tweet.
Example: place:"new york city" OR place:seattle OR place:fd70c22040963ac7
### place_country:
- Type: Standalone
- Availability: Advanced
Matches Tweets where the country code associated with a tagged place/location matches the given ISO alpha-2 character code.
You can find a list of valid ISO codes on Wikipedia.
You can only pass a single ISO code per place_country: operator.
Note: This operator will not match on Retweets, since Retweet's places are attached to the original Tweet. It will also not match on places attached to the original Tweet of a Quote Tweet.
Example: place_country:US OR place_country:MX OR place_country:CA
### point_radius:
- Type: Standalone
- Availability: Advanced
Matches against the place.geo.coordinates object of the Tweet when present, and in Twitter, against a place geo polygon, where the Place polygon is fully contained within the defined region.
point_radius:[longitude latitude radius]
Units of radius supported are miles (mi) and kilometers (km)
Radius must be less than 25mi
Longitude is in the range of ±180
Latitude is in the range of ±90
All coordinates are in decimal degrees
Rule arguments are contained within brackets, space delimited
You can only pass a single geo polygon per point_radius: operator.
Note: This operator will not match on Retweets, since Retweet's places are attached to the original Tweet. It will also not match on places attached to the original Tweet of a Quote Tweet.
Example: point_radius:[2.355128 48.861118 16km] OR point_radius:[-41.287336 174.761070 20mi]
### bounding_box:
- Type: Standalone
- Availability: Advanced
Matches against the place.geo.coordinates object of the Tweet when present, and in Twitter, against a place geo polygon, where the place polygon is fully contained within the defined region.
bounding_box:[west_long south_lat east_long north_lat]
west_long south_lat represent the southwest corner of the bounding box where west_long is the longitude of that point, and south_lat is the latitude.
east_long north_lat represent the northeast corner of the bounding box, where east_long is the longitude of that point, and north_lat is the latitude.
Width and height of the bounding box must be less than 25mi
Longitude is in the range of ±180
Latitude is in the range of ±90
All coordinates are in decimal degrees.
Rule arguments are contained within brackets, space delimited.
You can only pass a single geo polygons per bounding_box: operator.
Note: This operator will not match on Retweets, since Retweet's places are attached to the original Tweet. It will also not match on places attached to the original Tweet of a Quote Tweet.
Example: bounding_box:[-105.301758 39.964069 -105.178505 40.09455]
### is:retweet
- Type: Conjunction required
- Availability: Core
Matches on Retweets that match the rest of the specified rule. This operator looks only for true Retweets (for example, those generated using the Retweet button). Quote Tweets will not be matched by this operator.
Example: data @twitterdev -is:retweet
### is:reply
- Type: Conjunction required
- Availability: Core
Deliver only explicit replies that match a rule. Can also be negated to exclude replies that match a query from delivery.
Note: This operator is also available with the filtered stream endpoint. When used with filtered stream, this operator matches on replies to an original Tweet, replies in quoted Tweets, and replies in Retweets.
Example: from:twitterdev is:reply
### is:quote
- Type: Conjunction required
- Availability: Core
Returns all Quote Tweets, also known as Tweets with comments.
Example: "sentiment analysis" is:quote
### is:verified
- Type: Conjunction required
- Availability: Core
Deliver only Tweets whose authors are verified by Twitter.
Example: #nowplaying is:verified
### -is:nullcast
- Type: Conjunction required
- Availability: Advanced
Removes Tweets created for promotion only on ads.twitter.com that have a "source":"Twitter for Advertisers (legacy)" or "source":"Twitter for Advertisers".
This operator must be negated.
For more info on Nullcasted Tweets, see our page on Tweet availability.
Example: "mobile games" -is:nullcast
### has:hashtags
- Type: Conjunction required
- Availability: Core
Matches Tweets that contain at least one hashtag.
Example: from:twitterdev -has:hashtags
### has:cashtags
- Type: Conjunction required
- Availability: Advanced
Matches Tweets that contain a cashtag symbol (with a leading ‘$’ character. For example, $tag).
Example: #stonks has:cashtags
### has:links
- Type: Conjunction required
- Availability: Core
This operator matches Tweets which contain links and media in the Tweet body.
Example: from:twitterdev announcement has:links
### has:mentions
- Type: Conjunction required
- Availability: Core
Matches Tweets that mention another Twitter user.
Example: #nowplaying has:mentions
### has:media
- Type: Conjunction required
- Availability: Core
Matches Tweets that contain a media object, such as a photo, GIF, or video, as determined by Twitter. This will not match on media created with Periscope, or Tweets with links to other media hosting sites.
Example: (kittens OR puppies) has:media
### has:images
- Type: Conjunction required
- Availability: Core
Matches Tweets that contain a recognized URL to an image.
Example: #meme has:images
### has:videos
- Type: Conjunction required
- Availability: Core
Matches Tweets that contain native Twitter videos, uploaded directly to Twitter. This will not match on videos created with Periscope, or Tweets with links to other video hosting sites.
Example: #icebucketchallenge has:videos
### has:geo
- Type: Conjunction required
- Availability: Advanced
Matches Tweets that have Tweet-specific geolocation data provided by the Twitter user. This can be either a location in the form of a Twitter place, with the corresponding display name, geo polygon, and other fields, or in rare cases, a geo lat-long coordinate.
Note: Operators matching on place (Tweet geo) will only include matches from original tweets. Retweets do not contain any place data.
Example: recommend #paris has:geo -bakery
### lang:
- Type: Conjunction required
- Availability: Core
Matches Tweets that have been classified by Twitter as being of a particular language (if, and only if, the Tweet has been classified). It is important to note that each Tweet is currently only classified as being of one language, so AND’ing together multiple languages will yield no results.
You can only pass a single BCP 47 language identifier per lang: operator.
Note: if no language classification can be made the provided result is ‘und’ (for undefined).
Example: recommend #paris lang:en
The list below represents the currently supported languages and their corresponding BCP 47 language identifier:
- Amharic: am
- Arabic: ar
- Armenian: hy
- Basque: eu
- Bengali: bn
- Bosnian: bs
- Bulgarian: bg
- Burmese: my
- Croatian: hr
- Catalan: ca
- Czech: cs
- Danish: da
- Dutch: nl
- English: en
- Estonian: et
- Finnish: fi
- French: fr
- Georgian: ka
- German: de
- Greek: el
- Gujarati: gu
- Haitian Creole: ht
- Hebrew: iw
- Hindi: hi
- Latinized Hindi: hi-Latn
- Hungarian: hu
- Icelandic: is
- Indonesian: in
- Italian: it
- Japanese: ja
- Kannada: kn
- Khmer: km
- Korean: ko
- Lao: lo
- Latvian: lv
- Lithuanian: lt
- Malayalam: ml
- Maldivian: dv
- Marathi: mr
- Nepali: ne
- Norwegian: no
- Oriya: or
- Panjabi: pa
- Pashto: ps
- Persian: fa
- Polish: pl
- Portuguese: pt
- Romanian: ro
- Russian: ru
- Serbian: sr
- Simplified Chinese: zh-CN
- Sindhi: sd
- Sinhala: si
- Slovak: sk
- Slovenian: sl
- Sorani Kurdish: ckb
- Spanish: es
- Swedish: sv
- Tagalog: tl
- Tamil: ta
- Telugu: te
- Thai: th
- Tibetan: bo
- Traditional Chinese: zh-TW
- Turkish: tr
- Ukrainian: uk
- Urdu: ur
- Uyghur: ug
- Vietnamese: vi
- Welsh: cy
### has:profile_geo
Paid onlyAvailable
### profile_country
Paid onlyAvailable
### profile_locality
Paid onlyAvailable
### profile_region
Paid onlyAvailable
### proximity
Available
### :(
Available
### :)
Available
### ?
Available
### filter:periscope
Available
### filter:safe
Available
### list:
Available
Advanced
### filter:replies
Available
### filter:pro_video
Available
### filter:social
Available
### filter:trusted
Available
### filter:follows
Available
### filter:has_engagement
Available
### include:antisocial
Available
### include:offensive_user
Available
### include:antisocial_offensive_user
Available
### include:sensitive_content
Available
### source:
Available
### min_replies:
Available
### min_retweets:
Available
### min_faves:
Available
### card_name:
Available
### card_domain:
Available