Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.twitterapime.search
Class QueryComposer

    java.lang.Object
      com.twitterapime.search.QueryComposer

    public final class QueryComposer

extends java.lang.Object

This class is responsible for composing queries that are used to be sent to Twitter Search API. This class provides methods for most parameters/operators that are supported by Twitter Search API.

Since:
  1.0
Version:
  1.3
Author:
  Ernandes Mourao Junior (ernandes@gmail.com)
See Also:
  `Query`, `SearchDevice`, `Timeline`

Method Summary
`static Query` | `append(Query q1, Query q2)` Append a query to another one.
`static Query` | `containAll(java.lang.String words)` Create a query to search for tweets that contain all the given words.
`static Query` | `containAny(java.lang.String words)` Create a query to search for tweets that contain at least one of the given words.
`static Query` | `containExact(java.lang.String phrase)` Create a query to search for tweets that exactly match the given phrase, e.g., "The sky is blue.".
`static Query` | `containHashtag(java.lang.String tag)` Create a query to search for tweets that contain the given hashtag, e.g., "twitter".
`static Query` | `containLink()` Create a query to search for tweets that contain link(s).
`static Query` | `containNone(java.lang.String words)` Create a query to search for tweets that do not contain none of the given words.
`static Query` | `containQuestion()` Create a query to search for tweets that contain a question "?".
`static Query` | `count(int count)` Create a query to define the tweet count to be returned.
`static Query` | `from(java.lang.String person)` Create a query to search for tweets that were sent by a given person, e.g., "twitteruser".
`static Query` | `geocode(java.lang.String lat, java.lang.String lon, int rad, java.lang.String unit)` Create a query to search for tweets that were sent from a user that was located within a given radius of the given latitude/longitude.
`static Query` | `lang(java.lang.String lang)` Create a query to search for tweets that are from given language, e.g., "en".
`static Query` | `maxID(java.lang.String id)` Create a query to search for tweets that are lesser than or equal to a given ID, e.g., "123549789".
`static Query` | `negativeAttitude()` Create a query to search for tweets that contain a negative attitude ":(".
`static Query` | `page(int number)` Create a query to define the number of tweets page to be returned.
`static Query` | `paginate(int resultCount, int pageNumber)` Create a query to paginate the results to be returned.
`static Query` | `positiveAttitude()` Create a query to search for tweets that contain a positive attitude ":)".
`static Query` | `reference(java.lang.String person)` Create a query to search for tweets that reference a given person, e.g., "twitteruser".
`static Query` | `resultCount(int count)` Create a query to define the tweet count to be returned.
`static Query` | `since(java.util.Date date)` Create a query to search for tweets that were sent since a given date, e.g., "01/01/2009".
`static Query` | `sinceID(java.lang.String id)` Create a query to search for tweets that are greater than a given ID, e.g., "123549789".
`static Query` | `source(java.lang.String appName)` Create a query to search for tweets that were sent from a given source application, e.g., "web".
`static Query` | `to(java.lang.String person)` Create a query to search for tweets that were sent to a given person, e.g., "twitteruser".
`static Query` | `until(java.util.Date date)` Create a query to search for tweets that were sent until a given date, e.g., "01/10/2009".

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Method Detail

### append

    public static Query append(Query q1,
                               Query q2)

  Append a query to another one.

  Parameters:
    `q1` - Query 1.
    `q2` - Query 2.
  Returns:
    A new query object with the content from both queries concatenated.
  Throws:
    `java.lang.IllegalArgumentException` - If q1/q2 is null.

### containAll

    public static Query containAll(java.lang.String words)

  Create a query to search for tweets that contain all the given words. To specify more than one word, the words must be separated by a white space, e.g., "java sun microsystems".

  Parameters:
    `words` - The words.
  Returns:
    A new query.

### containExact

    public static Query containExact(java.lang.String phrase)

  Create a query to search for tweets that exactly match the given phrase, e.g., "The sky is blue.".

  Parameters:
    `phrase` - The phrase.
  Returns:
    A new query.

### containAny

    public static Query containAny(java.lang.String words)

  Create a query to search for tweets that contain at least one of the given words. To specify more than one word, the words must be separated by a white space, e.g., "java .net linux".

  Parameters:
    `words` - The words.
  Returns:
    A new query.

### containNone

    public static Query containNone(java.lang.String words)

  Create a query to search for tweets that do not contain none of the given words. To specify more than one word, the words must be separated by a white space, e.g., ".net microsoft".

  Parameters:
    `words` - The words.
  Returns:
    A new query.

### containHashtag

    public static Query containHashtag(java.lang.String tag)

  Create a query to search for tweets that contain the given hashtag, e.g., "twitter".

  Parameters:
    `tag` - The tag.
  Returns:
    A new query.

### from

    public static Query from(java.lang.String person)

  Create a query to search for tweets that were sent by a given person, e.g., "twitteruser".

  Parameters:
    `person` - The person.
  Returns:
    A new query.

### reference

    public static Query reference(java.lang.String person)

  Create a query to search for tweets that reference a given person, e.g., "twitteruser".

  Parameters:
    `person` - The person.
  Returns:
    A new query.

### to

    public static Query to(java.lang.String person)

  Create a query to search for tweets that were sent to a given person, e.g., "twitteruser".

  Parameters:
    `person` - The person.
  Returns:
    A new query.

### since

    public static Query since(java.util.Date date)

  Create a query to search for tweets that were sent since a given date, e.g., "01/01/2009".

  This query must be appended to another one, otherwise Twitter Search API may return an error.

  Parameters:
    `date` - The date.
  Returns:
    A new query.
  Throws:
    `java.lang.IllegalArgumentException` - If date is null.

### until

    public static Query until(java.util.Date date)

  Create a query to search for tweets that were sent until a given date, e.g., "01/10/2009".

  This query must be appended to another one, otherwise Twitter Search API may return an error.

  Parameters:
    `date` - The date.
  Returns:
    A new query.
  Throws:
    `java.lang.IllegalArgumentException` - If date is null.

### sinceID

    public static Query sinceID(java.lang.String id)

  Create a query to search for tweets that are greater than a given ID, e.g., "123549789".

  This query must be appended to another one, otherwise Twitter Search API may return an error.

  Parameters:
    `id` - The ID.
  Returns:
    A new query.

### maxID

    public static Query maxID(java.lang.String id)

  Create a query to search for tweets that are lesser than or equal to a given ID, e.g., "123549789".

  Parameters:
    `id` - The ID.
  Returns:
    A new query.

### lang

    public static Query lang(java.lang.String lang)

  Create a query to search for tweets that are from given language, e.g., "en".

  This query must be appended to another one, otherwise Twitter Search API may return an error.

  Parameters:
    `lang` - The language code.
  Returns:
    A new query.

### source

    public static Query source(java.lang.String appName)

  Create a query to search for tweets that were sent from a given source application, e.g., "web".

  This query must be appended to another one, otherwise Twitter Search API may return an error.

  Parameters:
    `appName` - The application name.
  Returns:
    A new query.

### resultCount

    public static Query resultCount(int count)

  Create a query to define the tweet count to be returned.

  This query must be appended to another one, otherwise Twitter Search API may return an error.

  Parameters:
    `count` - The count.
  Returns:
    A new query.

### count

    public static Query count(int count)

  Create a query to define the tweet count to be returned.

  This query must be used only with REST API search methods. For Search API search methods, use `resultCount(int)` instead.

  Parameters:
    `count` - The count.
  Returns:
    A new query.

### page

    public static Query page(int number)

  Create a query to define the number of tweets page to be returned.

  This query must be appended to another one, otherwise Twitter Search API may return an error.

  Parameters:
    `number` - The page number.
  Returns:
    A new query.

### paginate

    public static Query paginate(int resultCount,
                                 int pageNumber)

  Create a query to paginate the results to be returned.

  This query must be appended to another one, otherwise Twitter Search API may return an error.

  Parameters:
    `resultCount` - The result count.
    `pageNumber` - The page number.
  Returns:
    A new query.

### geocode

    public static Query geocode(java.lang.String lat,
                                java.lang.String lon,
                                int rad,
                                java.lang.String unit)

  Create a query to search for tweets that were sent from a user that was located within a given radius of the given latitude/longitude. e.g., "40.757929,-73.985506,25km".

  Parameters:
    `lat` - The latitude.
    `lon` - The longitude.
    `rad` - The radius.
    `unit` - The radius unit ("mi" or "km").
  Returns:
    A new query.

### positiveAttitude

    public static Query positiveAttitude()

  Create a query to search for tweets that contain a positive attitude ":)".

  Returns:
    A new query.

### negativeAttitude

    public static Query negativeAttitude()

  Create a query to search for tweets that contain a negative attitude ":(".

  Returns:
    A new query.

### containLink

    public static Query containLink()

  Create a query to search for tweets that contain link(s).

  This query must be appended to another one, otherwise Twitter Search API may return an error.

  Returns:
    A new query.

### containQuestion

    public static Query containQuestion()

  Create a query to search for tweets that contain a question "?".

  Returns:
    A new query.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2010 Twitter API ME Team. All Rights Reserved.