@Bindable(prefix="Bing7DocumentSource", inherit=CommonAttributes.class) public class Bing7DocumentSource extends MultipageSearchEngine
IDocumentSource
fetching web page search results from Bing,
using Search API V7.
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_BING7_API
System property name for passing Bing API key.
|
searchMode
compressed, documents, POSTPROCESSING, query, results, resultsTotal, SERVICE, start, statistics
Modifier | Constructor and Description |
---|---|
|
Bing7DocumentSource() |
protected |
Bing7DocumentSource(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, runQuery
afterFetch, clean, urlEncode
afterProcessing, beforeProcessing, dispose, getContext, getSharedExecutor, init
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
afterProcessing, beforeProcessing, dispose, init
public static final String SYSPROP_BING7_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: bing7.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 Bing7DocumentSource()
protected Bing7DocumentSource(MultipageSearchEngineMetadata metadata, String serviceURL)
public final void process() throws ProcessingException
IProcessingComponent
process
in interface IProcessingComponent
process
in class ProcessingComponentBase
ProcessingException
- 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
MultipageSearchEngine
documents
to the set of
returned documents.process
in class MultipageSearchEngine
ProcessingException
protected final Callable<SearchEngineResponse> createFetcher(MultipageSearchEngine.SearchRange bucket)
createFetcher
in class MultipageSearchEngine
bucket
- 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)