Class Query

  extended by java.util.AbstractMap<K,V>
      extended by java.util.HashMap<java.lang.String,java.lang.String>
          extended by
All Implemented Interfaces:, java.lang.Cloneable, java.util.Map<java.lang.String,java.lang.String>

public class Query
extends java.util.HashMap<java.lang.String,java.lang.String>

This class is used as a basic query container. It works as a key-value-store, see the static fields for available keys. The URL is the API services base URL and should be set in the properties file, it will be overwritten with the value from there. The PARAMETERS value is created from other fields (e.g. country, language, results...) so it should not be set directly too. The OFFSET field is used to retrieve more results with several subsequent requests. It MUST NOT be set if one wants the top results returned from the service. If it is set to a number N the top N results will not appear in the results list.

$Id:,v 1.2 2012/05/09 14:45:20 hoppe Exp $
See Also:
Serialized Form

Nested Class Summary
Nested classes/interfaces inherited from class java.util.AbstractMap
java.util.AbstractMap.SimpleEntry<K,V>, java.util.AbstractMap.SimpleImmutableEntry<K,V>
Field Summary
static java.lang.String OFFSET
          An offset for the results to retrieve.
static java.lang.String PHRASE
          The phrase to search for.
static java.lang.String RESULTS
          The maximum number of wanted results.
static java.lang.String URL
          The basic url for the search engine.
Constructor Summary
Query(java.lang.String phrase)
          Default constructor for queries.
Method Summary
Methods inherited from class java.util.HashMap
clear, clone, containsKey, containsValue, entrySet, get, isEmpty, keySet, put, putAll, remove, size, values
Methods inherited from class java.util.AbstractMap
equals, hashCode, toString
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.util.Map
equals, hashCode

Field Detail


public static final java.lang.String URL
The basic url for the search engine. This is set from the properties for each ASearchEngine implementation and MUST NOT be overwritten. Although it's possible to look up this field for debugging.

See Also:
Constant Field Values


public static final java.lang.String OFFSET
An offset for the results to retrieve. This is automatically set to 0 and counts up if more results are required than possible to get with one request. The maximum possible results for one request depends on the search engine and is set in the ASearchEngine implementations properties.

See Also:
Constant Field Values


public static final java.lang.String PHRASE
The phrase to search for. This is usually set via the Query c'tor.

See Also:
Constant Field Values


public static final java.lang.String RESULTS
The maximum number of wanted results. A default value is set in the ASearchEngine implementations properties. Note that some search engines limit the number of possible results to get via API and that some search phrases don't provide more than just a few results.

See Also:
Constant Field Values
Constructor Detail


public Query(java.lang.String phrase)
Default constructor for queries. Additional options can be enabled via the put(String key, String value) Method. A list of currently available keys is given by the static Fields of this class.

phrase - The search string.