Search Tag

Returns tweets that match a specified query.

This tag has changed a lot in the 1.1 version of the Twitter API. In particular, the {results}...{/results} tagpair is now a {statuses}...{/statuses} tagpair. The variables used for the returned statuses are now consistent with those used for the timeline tag and other status returning tags. The new consistency is a very welcome change, but take note that you may need to update your template code for this tag if you are upgrading from CE Tweet version 1.2 or earlier.

Example

@bjornbjorn got a workaround. Fed the category image output via CE Image configured to use S3. Image now loads from CDN.
Novartis sets heart-drug price w/ 2 insurers based on health outcome. How do they tell what's causing effect? tinyurl.com/h6yjt49
RT @causingeffect: Add-on update: CE Image and CE String updates are planned for next week. #eecms

Note: These docs are static, so relative dates may be inaccurate.

Note: You have complete control over the code, variables, and style of your Tweets. If you plan on utilizing the reply, favorite, and/or retweet actions, make sure to add the Twitter Web Intents script (see the Intents Script Tag for more details):

{exp:ce_tweet:intents_script}
<div class="ce_tweet_holder group">
{exp:ce_tweet:search q='causingeffect OR "CE Image" OR "causing effect" OR "ce_img" OR aaronwaldon OR "CE Cache" lang:en' count="5"}
    {statuses}
    <div class="ce_tweet">
        <div class="ce_tweet_left">
            <a class="ce_tweet_username" href="http://twitter.com/{user_screen_name}" target="_blank"><img src="{user_profile_image_url}" alt="" /></a>
        </div><!-- .ce_tweet_left -->
        <div class="ce_tweet_right">
            <div class="ce_tweet_row">
                <a class="ce_tweet_username" href="http://twitter.com/{user_screen_name}" target="_blank">{user_name}</a>
                <a class="ce_tweet_name" href="http://twitter.com/{user_screen_name}" target="_blank">{user_screen_name}</a>
            </div><!-- .ce_tweet_row -->
            <div class="ce_tweet_row ce_tweet_text">{text}</div>
            <div class="ce_tweet_row ce_tweet_actions">
                <a class="ce_tweet_time" href="https://twitter.com/{user_screen_name}/statuses/{id_str}" title="{created_at format="%g:%i %A, %M %j%S (%T)"}" target="_blank"><span class="icon-twitter"></span> {created_at_relative}</a>
                <a class="ce_tweet_reply" href="https://twitter.com/intent/tweet?in_reply_to={id_str}" target="_blank"><span>Reply</span></a>
                <a class="ce_tweet_retweet{if retweeted} ce_tweet_retweeted{/if}" href="https://twitter.com/intent/retweet?tweet_id={id_str}" target="_blank"><span>Retweet</span></a>
                <a class="ce_tweet_favorite{if favorited} ce_tweet_favorited{/if}" href="https://twitter.com/intent/favorite?tweet_id={id_str}" target="_blank"><span>Favorite</span></a>
            </div><!-- .ce_tweet_row -->
        </div><!-- .ce_tweet_right -->
    </div><!-- .ce_tweet -->
    {/statuses}
{/exp:ce_tweet:search}
</div><!-- .ce_tweet_holder -->

Parameters

Note: The q= parameter is required. The other parameters are all optional.

q=

Search query. Queries will be limited by Twitter by complexity. To see how to create a custom search query, please take a look at the Search Operators section of the Using the Twitter Search API page.

count=

Specifies the number of records to retrieve. Must be less than or equal to 100. Defaults to "20".

geocode=

Returns tweets by users located within a given radius of the given latitude/longitude. The location is preferentially taking from the Geotagging API, but will fall back to their Twitter profile. The parameter value is specified by "latitude,longitude,radius", where radius units must be specified as either "mi" (miles) or "km" (kilometers). Note that you cannot use the near operator via the API to geocode arbitrary locations; however you can use this geocode parameter to search near geocodes directly.

lang=

Restricts tweets to the given language, given by an ISO 639-1 code. Example: "en".

result_type=

Specifies what type of search results you would prefer to receive. The default is "recent". Valid values include:

  • "mixed": Include both popular and real time results in the response.
  • "recent": return only the most recent results in the response
  • "popular": return only the most popular results in the response.

until=

Returns tweets generated before the given date. Date should be formatted as YYYY-MM-DD.

since_id=

Returns results with an id greater than (that is, more recent than) the specified id. There are limits to the number of Tweets which can be accessed through the API. If the limit of Tweets has occurred since the since_id=, the since_id= will be forced to the oldest id available. Example: 12345

max_id=

Returns results with an id less than (that is, older than) or equal to the specified id. Example: 54321

include_entities=

When set to "yes", each tweet will include a variety of metadata about the tweet, including: user_mentions, urls, and hashtags. The default is "yes".

link=

Should the text be hyperlinked? Can be one or more of the following:

  • h Link hashtags like #example
  • m Link mention like @causingeffect
  • u Link URLs like http://www.causingeffect.com

Multiple values should be pipe delimited. Defaults to "h|m|u".

seconds=

The amount of time to cache this tag’s output.

Variables

{total_status_count}
{statuses}
    {status_count}
    {metadata_result_type}
    {metadata_iso_language_code}
    {created_at}
    {created_at_relative}
    {id}
    {id_str}
    {is_retweet}
    {text}
    {source}
    {truncated}
    {in_reply_to_status_id}
    {in_reply_to_status_id_str}
    {in_reply_to_user_id}
    {in_reply_to_user_id_str}
    {in_reply_to_screen_name}
    {user_id}
    {user_id_str}
    {user_name}
    {user_screen_name}
    {user_location}
    {user_description}
    {user_url}
    {user_protected}
    {user_followers_count}
    {user_friends_count}
    {user_listed_count}
    {user_created_at}
    {user_created_at_relative}
    {user_favourites_count}
    {user_utc_offset}
    {user_time_zone}
    {user_geo_enabled}
    {user_verified}
    {user_statuses_count}
    {user_lang}
    {user_profile_background_color}
    {user_profile_background_image_url}
    {user_profile_background_image_url_https}
    {user_profile_background_tile}
    {user_profile_image_url}
    {user_profile_image_url_https}
    {user_profile_link_color}
    {user_profile_sidebar_border_color}
    {user_profile_sidebar_fill_color}
    {user_profile_text_color}
    {user_profile_use_background_image}
    {user_default_profile}
    {user_default_profile_image}
    {favorited}
    {retweeted}
    {text_raw}
{/statuses}
{search_metadata_completed_in}
{search_metadata_max_id}
{search_metadata_max_id_str}
{search_metadata_next_results}
{search_metadata_query}
{search_metadata_refresh_url}
{search_metadata_count}
{search_metadata_since_id}
{search_metadata_since_id_str}

Note: Take a look at the Twitter Tweets documentation for more details about the variables.

Twitter Resources

This method is an implementation of the Twitter search REST API.