@Bindable(prefix="Bing3DocumentSource",
inherit=CommonAttributes.class)
public abstract class Bing3DocumentSource
extends MultipageSearchEngine
IDocumentSource sending requests to Bing Search API in Windows Azure
Marketplace. We model this into separate subclasses, specific to a particular request
type (web, image, news).
Important: there are limits for free use of the above API (beyond which it is a paid service).
| Modifier and Type | Class and Description |
|---|---|
static class |
Bing3DocumentSource.AtomEntry |
static class |
Bing3DocumentSource.AtomFeed |
static class |
Bing3DocumentSource.ContentEntry |
static class |
Bing3DocumentSource.EntryProperties |
static class |
Bing3DocumentSource.Thumbnail |
MultipageSearchEngine.SearchEngineResponseCallable, MultipageSearchEngine.SearchMode, MultipageSearchEngine.SearchRange| Modifier and Type | Field and Description |
|---|---|
AdultOption |
adult
Adult search restriction (porn filter).
|
String |
appid
Microsoft-assigned application ID for querying the API.
|
Double |
latitude
Latitude (north/south coordinate).
|
Double |
longitude
Longitude (east/west coordinate).
|
MarketOption |
market
Language and country/region information for the request.
|
protected static int |
MAX_CONCURRENT_THREADS
Maximum concurrent threads from all instances of this subcomponents
sending requests to Bing.
|
HttpRedirectStrategy |
redirectStrategy
HTTP redirect response strategy (follow or throw an error).
|
static String |
SYSPROP_BING3_API
System property key under which Bing app key can be passed (default).
|
searchModecompressed, documents, POSTPROCESSING, query, results, resultsTotal, SERVICE, start, statistics| Constructor and Description |
|---|
Bing3DocumentSource(SourceType sourceType)
Initialize with a fixed source type.
|
| Modifier and Type | Method and Description |
|---|---|
protected void |
addIfNotEmpty(ArrayList<org.apache.http.NameValuePair> params,
String paramName,
Object value)
Add a parameter if argument is not an empty string.
|
protected void |
appendSourceParams(ArrayList<org.apache.http.NameValuePair> params)
Append any source-specific parameters.
|
protected Callable<SearchEngineResponse> |
createFetcher(MultipageSearchEngine.SearchRange bucket)
Create a single page fetcher for the search range.
|
abstract void |
process()
Make this abstract so that subclasses override.
|
protected void |
process(MultipageSearchEngineMetadata metadata,
ExecutorService executor)
Run a request the search engine's API, setting
documents to the set of
returned documents. |
protected static String |
stringValue(Object v) |
collectDocuments, runQueryafterFetch, clean, urlEncodeafterProcessing, beforeProcessing, dispose, getContext, getSharedExecutor, initclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitafterProcessing, beforeProcessing, dispose, initpublic static final String SYSPROP_BING3_API
protected static final int MAX_CONCURRENT_THREADS
@Processing @Input @Attribute @Label(value="Application API key") @Level(value=BASIC) @Group(value="Service") @Required public String appid
By default takes the system property's value under key: bing3.key.
@Input @Processing @Attribute @Label(value="Market") @Level(value=BASIC) @Group(value="Filtering") public MarketOption market
@Processing @Input @Attribute @Label(value="Safe search") @Level(value=MEDIUM) @Group(value="Filtering") public AdultOption adult
@Processing @Input @Attribute @Label(value="Latitude hint") @Level(value=MEDIUM) @Group(value="Filtering") public Double latitude
@Processing @Input @Attribute @Label(value="Longitude hint") @Level(value=MEDIUM) @Group(value="Filtering") public Double longitude
@Input @Processing @Attribute @Label(value="HTTP redirect strategy") @Level(value=MEDIUM) @Group(value="Service") @Internal public HttpRedirectStrategy redirectStrategy
public Bing3DocumentSource(SourceType sourceType)
protected void process(MultipageSearchEngineMetadata metadata, ExecutorService executor) throws ProcessingException
MultipageSearchEnginedocuments to the set of
returned documents.process in class MultipageSearchEngineProcessingExceptionprotected final Callable<SearchEngineResponse> createFetcher(MultipageSearchEngine.SearchRange bucket)
createFetcher in class MultipageSearchEnginebucket - The search range to fetch.protected void addIfNotEmpty(ArrayList<org.apache.http.NameValuePair> params, String paramName, Object value)
public abstract void process()
throws ProcessingException
process in interface IProcessingComponentprocess in class ProcessingComponentBaseProcessingException - when processing failed. If thrown, the
IProcessingComponent.afterProcessing() method will be called and the component will
be ready to accept further requests or to be disposed of. Finally, the
exception will be rethrown from the controller method that caused the
component to perform processing.protected void appendSourceParams(ArrayList<org.apache.http.NameValuePair> params)