org.carrot2.source.boss
Class BossSearchService

java.lang.Object
  extended by org.carrot2.source.boss.BossSearchService
Direct Known Subclasses:
BossImageSearchService, BossNewsSearchService, BossWebSearchService

public abstract class BossSearchService
extends Object

A superclass shared between various Boss verticals.


Field Summary
 String appid
          Application ID required for BOSS services.
static String CARROTSEARCH_APPID
          Yahoo BOSS application ID assigned to Carrot2/ Carrot Search.
 BossLanguageCodes languageAndRegion
          Restricts search to the specified language and region.
protected  org.slf4j.Logger logger
          Logger for this object.
protected  MultipageSearchEngineMetadata metadata
          BOSS engine current metadata.
 String sites
          Restricts search results to a set of sites.
static String YBOSS_RESPONSE
          Metadata key for the originally returned YSearchResponse.
 
Method Summary
protected abstract  ArrayList<org.apache.commons.httpclient.NameValuePair> createRequestParams(String query, int start, int results)
          Prepare an array of NameValuePair (parameters for the request).
protected abstract  String getServiceURI()
           
protected  SearchEngineResponse query(String query, int start, int results)
          Sends a search query to Yahoo! and parses the result.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

protected final org.slf4j.Logger logger
Logger for this object.


CARROTSEARCH_APPID

public static final String CARROTSEARCH_APPID
Yahoo BOSS application ID assigned to Carrot2/ Carrot Search. Use your own, please.

See Also:
Constant Field Values

YBOSS_RESPONSE

public static final String YBOSS_RESPONSE
Metadata key for the originally returned YSearchResponse.

See Also:
SearchEngineResponse.metadata, Constant Field Values

appid

public String appid
Application ID required for BOSS services. Please generate your own ID for production deployments and branches off the Carrot2.org's code.

Attribute label:
Application ID
Attribute level:
Advanced
Attribute group:
Service

sites

public String sites
Restricts search results to a set of sites. Must be a comma-separated list of site's domain names, e.g. abc.com,cnn.com.

Attribute label:
Domain restriction
Attribute level:
Medium
Attribute group:
Results filtering

languageAndRegion

public BossLanguageCodes languageAndRegion
Restricts search to the specified language and region. Must be a concatenation of constants defined by the language codes supported by the Yahoo Boss API.

The following languages and regions are currently (July 2009) supported:

Country Region Language
Argentina ar es
Austria at de
Australia au en
Brazil br pt
Canada - English ca en
Canada - French ca fr
Catalan ct ca
Chile cl es
Columbia co es
Czech Republic cz cs
Denmark dk da
Finland fi fi
Hong Kong hk tzh
Hungary Hungary hu hu
Indonesia - English id en
Indonesia - Indonesian id id
Israel il he
India in en
Japan jp jp
Korea kr kr
Mexico mx es
Malaysia - English my en
Malaysia my ms
Netherlands nl nl
Norway no no
New Zealand nz en
Peru pe es
Philippines ph tl
Philippines - English ph en
Russia ru ru
Romania ro ro
Sweden se sv
Singapore sg en
Taiwan tw tzh
Thailand th th
Turkey tr tr
Switzerland - German ch de
Switzerland - French ch fr
Switzerland - Italian ch it
German de de
Spanish es es
French fr fr
Italian it it
United Kingdom uk en
United States - English us en
United States - Spanish us es
Vietnam vn vi
Venezuela ve es

Use BossLanguageCodes.getAttributeValue() to acquire proper constant for this field.

See Also:
BossLanguageCodes
Attribute label:
Language and Region
Attribute level:
Medium
Attribute group:
Results filtering

metadata

protected MultipageSearchEngineMetadata metadata
BOSS engine current metadata.

Method Detail

createRequestParams

protected abstract ArrayList<org.apache.commons.httpclient.NameValuePair> createRequestParams(String query,
                                                                                              int start,
                                                                                              int results)
Prepare an array of NameValuePair (parameters for the request).


getServiceURI

protected abstract String getServiceURI()
Returns:
Return service URI for this service.

query

protected final SearchEngineResponse query(String query,
                                           int start,
                                           int results)
                                    throws IOException
Sends a search query to Yahoo! and parses the result.

Throws:
IOException


Copyright (c) Dawid Weiss, Stanislaw Osinski