@Bindable(prefix="Bing5DocumentSource",
inherit=CommonAttributes.class)
public class Bing5DocumentSource
extends MultipageSearchEngine
IDocumentSource fetching web page search results from Bing,
using Search API V5.
Important: there are limits for free use of the above API (beyond which it is a paid service).
MultipageSearchEngine.SearchEngineResponseCallable, MultipageSearchEngine.SearchMode, MultipageSearchEngine.SearchRange| Modifier and Type | Field and Description |
|---|---|
AdultOption |
adult
Adult search restriction (porn filter).
|
String |
apiKey
The API key used to authenticate requests.
|
MarketOption |
market
Language and country/region information for the request.
|
HttpRedirectStrategy |
redirectStrategy
HTTP redirect response strategy (follow or throw an error).
|
boolean |
respectRateLimits
Respect official guidelines concerning rate limits.
|
String |
site
Site restriction to return value under a given URL.
|
static String |
SYSPROP_BING5_API
System property name for passing Bing API key.
|
searchModecompressed, documents, POSTPROCESSING, query, results, resultsTotal, SERVICE, start, statistics| Modifier | Constructor and Description |
|---|---|
|
Bing5DocumentSource() |
protected |
Bing5DocumentSource(MultipageSearchEngineMetadata metadata,
String serviceURL) |
| Modifier and Type | Method and Description |
|---|---|
protected void |
augmentSearchHeaders(List<org.apache.http.Header> headers) |
protected void |
augmentSearchParameters(List<org.apache.http.NameValuePair> params) |
protected Callable<SearchEngineResponse> |
createFetcher(MultipageSearchEngine.SearchRange bucket)
Create a single page fetcher for the search range.
|
protected void |
handleResponse(BingResponse response,
SearchEngineResponse ser) |
void |
process()
Performs the processing required to fulfill the request.
|
protected void |
process(MultipageSearchEngineMetadata metadata,
ExecutorService executor)
Run a request the search engine's API, setting
documents to the set of
returned documents. |
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_BING5_API
@Processing @Input @Attribute @Label(value="Application API key") @Level(value=BASIC) @Group(value="Service") @Required public String apiKey
By default takes the system property's value under key: bing5.key.
@Processing @Input @Attribute @Label(value="Site restriction") @Level(value=ADVANCED) @Group(value="Filtering") public String site
@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
@Input @Processing @Attribute @Label(value="HTTP redirect strategy") @Level(value=MEDIUM) @Group(value="Service") @Internal public HttpRedirectStrategy redirectStrategy
@Input @Processing @Attribute @Label(value="Respect request rate limits") @Level(value=ADVANCED) @Group(value="Service") public boolean respectRateLimits
public Bing5DocumentSource()
protected Bing5DocumentSource(MultipageSearchEngineMetadata metadata, String serviceURL)
public final void process()
throws ProcessingException
IProcessingComponentprocess 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 final 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 augmentSearchHeaders(List<org.apache.http.Header> headers)
protected void augmentSearchParameters(List<org.apache.http.NameValuePair> params)
protected void handleResponse(BingResponse response, SearchEngineResponse ser)