googlesearch
Class SimpleQuery

java.lang.Object
  extended by googlesearch.Query
      extended by googlesearch.SimpleQuery

public class SimpleQuery
extends Query

Encapsulates Google search queries as objects. The search string can be as simple as a single word, or it can include any of the special features of the Google advanced search specification. Note that simple searches (words) can be combined using other objects in the package.

Structurally, these are the leaves of a query tree and the base case of the recursion that processes those trees.

Author:
jbergin

Field Summary
 
Fields inherited from class googlesearch.Query
NULL_QUERY
 
Constructor Summary
SimpleQuery(java.lang.String searchString)
          Create a google query with a given search string, usually just a single word.
 
Method Summary
 java.lang.String buildSearchString(java.util.List<Query> start, java.util.List<Query> finish)
          Used by getSearchString to build up the query string recursively from the parts.
 java.lang.String getSearchString()
          Obtain the search string specified when the object was created.
 
Methods inherited from class googlesearch.Query
getQueryKey, lucky, modifier, search, search, setQueryKey, suggestSpelling, toString
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SimpleQuery

public SimpleQuery(java.lang.String searchString)
Create a google query with a given search string, usually just a single word.

Parameters:
searchString - the Google search string.
Method Detail

buildSearchString

public java.lang.String buildSearchString(java.util.List<Query> start,
                                          java.util.List<Query> finish)
Description copied from class: Query
Used by getSearchString to build up the query string recursively from the parts. Note that the work is done on the unwinding phase of the recursion. Those query fragments that must appear first or last in a query string defer being added to the string until the end, by putting a reference to themselves intoone of the two lists. These lists are then processed at the end after some verification.

Specified by:
buildSearchString in class Query
Parameters:
start - the list of query objects that must come first in a Google query
finish - the list of query objects that must come last in a Google query. e.g. site:
Returns:
the query string

getSearchString

public java.lang.String getSearchString()
Description copied from class: Query
Obtain the search string specified when the object was created.

Specified by:
getSearchString in class Query
Returns:
the search string