A connection to the QRserver can be established using three approaches.One approach takes no parameters, but relies on the properties being specified in the com.fastsearch.esp.search.SearchFactory.properties file.
Default value is the HTTPSearchFactory factoryinstance:
Code:
ISearchFactory factory = SearchFactory.newInstance()
A second approach requires you to instantiate a Search Factory based on a factory class, passed as a String.
The default implementation is com.fastsearch.esp.search.http.HttpSearchFactory:
Code:
String factory_name = "com.fastsearch.esp.search.http.HttpSearchFactory"ISearchFactory factory = SearchFactory.newInstance(factory)
A third approach requires you to instantiate a Search Factory based on a Properties object. The followingproperty is mandarory:
Code:
Properties prop = new Properties();prop.setProperty("com.fastsearch.esp.search.http.qrservers", "host1:port,host2:port");
ISearchFactory factory = SearchFactory.newInstance(prop);
Other available parameters:
• By default, ESP uses HTTP GET as request method. When using QBE (Query By Example), the requestmethod must be set to HTTP POST:
Code:
com.fastsearch.esp.search.http.requestmethod• Use secure socket layer when searching the Java API, default is false:
Code:
com.fastsearch.esp.search.http.usessl
• Set the maximum number of connections for a HttpSearhEngine object, default is 10. Note, that if you aresearching through search-views, each search-view instance will hold one HttpSearchEngine instance foreach QRServer:
Code:
com.fastsearch.esp.search.http.maxconnections
• Specify a proxy server used by the API's httpclient. Default is disabled, but the API will still look for proxiesconfigured through Java's system property http.proxyHost and http.proxyPort. If the system property isset and you do not want the search API to use it, override by setting this parameter to "none":
Code:
com.fastsearch.esp.search.http.proxy
All three approaches allow for the specification of multiple QRservers. However, the first and second approachrequire hostnames and ports to be specified in the factory's properties file. The third approach allows forhostnames and ports to be specified as arguments to the properties object. The arguments will then beappended to the factorys properties file.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment