googlesearch
Class ExactQuery

java.lang.Object
  extended by googlesearch.Query
      extended by googlesearch.CompositeQuery
          extended by googlesearch.ExactQuery

public class ExactQuery
extends CompositeQuery

Transforms any query into one that searches for the exact phrase in the given query, rather than searching for the words individually.

Author:
jbergin

Field Summary
 
Fields inherited from class googlesearch.Query
NULL_QUERY
 
Constructor Summary
ExactQuery(Query query)
           
 
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.
static boolean isExact(java.lang.String query)
          Is the current search string already an exact search?
static java.lang.String stripQuotes(java.lang.String query)
          Strip the delimiting quotes off a string.
 
Methods inherited from class googlesearch.CompositeQuery
getSearchString
 
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

ExactQuery

public ExactQuery(Query query)
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

isExact

public static boolean isExact(java.lang.String query)
Is the current search string already an exact search?

Returns:
true if the search is already exact

stripQuotes

public static java.lang.String stripQuotes(java.lang.String query)
Strip the delimiting quotes off a string. Used by DefinitionQuery.

Parameters:
query - any string
Returns:
the string without delimiting quotes