Package eu.clarin.sru.server.utils
Class SRUSearchEngineBase
- java.lang.Object
-
- eu.clarin.sru.server.utils.SRUSearchEngineBase
-
- All Implemented Interfaces:
SRUSearchEngine
public abstract class SRUSearchEngineBase extends Object implements SRUSearchEngine
Base class required for anSRUSearchEngine
implementation to be used with theSRUServerServlet
Servlet.
-
-
Constructor Summary
Constructors Constructor Description SRUSearchEngineBase()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
destroy()
Destroy the search engine.SRUExplainResult
explain(SRUServerConfig config, SRURequest request, SRUDiagnosticList diagnostics)
Handle a explain operation.void
init(javax.servlet.ServletContext context, SRUServerConfig config, SRUQueryParserRegistry.Builder parsersRegistryBuilder, Map<String,String> params)
Initialize the search engine.SRUScanResultSet
scan(SRUServerConfig config, SRURequest request, SRUDiagnosticList diagnostics)
Handle a scan operation.abstract SRUSearchResultSet
search(SRUServerConfig config, SRURequest request, SRUDiagnosticList diagnostics)
Handle a searchRetrieve operation.
-
-
-
Method Detail
-
explain
public SRUExplainResult explain(SRUServerConfig config, SRURequest request, SRUDiagnosticList diagnostics) throws SRUException
Handle a explain operation. The default implementation is a no-op. Override this method, if you want to provide a custom behavior.- Specified by:
explain
in interfaceSRUSearchEngine
- Parameters:
config
- theSRUEndpointConfig
object that contains the endpoint configurationrequest
- theSRURequest
object that contains the request made to the endpointdiagnostics
- theSRUDiagnosticList
object for storing non-fatal diagnostics- Returns:
- a
SRUExplainResult
object ornull
if the search engine does not want to provide writeExtraResponseData - Throws:
SRUException
- if an fatal error occurred- See Also:
SRUSearchEngine.explain(SRUServerConfig, SRURequest, SRUDiagnosticList)
-
scan
public SRUScanResultSet scan(SRUServerConfig config, SRURequest request, SRUDiagnosticList diagnostics) throws SRUException
Handle a scan operation. The default implementation is a no-op. Override this method, if you want to provide a custom behavior.- Specified by:
scan
in interfaceSRUSearchEngine
- Parameters:
config
- theSRUEndpointConfig
object that contains the endpoint configurationrequest
- theSRURequest
object that contains the request made to the endpointdiagnostics
- theSRUDiagnosticList
object for storing non-fatal diagnostics- Returns:
- a
SRUScanResultSet
object ornull
if this operation is not supported by this search engine - Throws:
SRUException
- if an fatal error occurred- See Also:
SRUSearchEngine.scan(SRUServerConfig, SRURequest, SRUDiagnosticList)
-
search
public abstract SRUSearchResultSet search(SRUServerConfig config, SRURequest request, SRUDiagnosticList diagnostics) throws SRUException
Handle a searchRetrieve operation.- Specified by:
search
in interfaceSRUSearchEngine
- Parameters:
config
- theSRUEndpointConfig
object that contains the endpoint configurationrequest
- theSRURequest
object that contains the request made to the endpointdiagnostics
- theSRUDiagnosticList
object for storing non-fatal diagnostics- Returns:
- a
SRUSearchResultSet
object - Throws:
SRUException
- if an fatal error occurred- See Also:
SRUSearchEngine.search(SRUServerConfig, SRURequest, SRUDiagnosticList)
-
init
public void init(javax.servlet.ServletContext context, SRUServerConfig config, SRUQueryParserRegistry.Builder parsersRegistryBuilder, Map<String,String> params) throws SRUConfigException
Initialize the search engine.- Parameters:
context
- theServletContext
for the Servletconfig
- theSRUServerConfig
object for this search engineparsersRegistryBuilder
- theSRUQueryParserRegistry.Builder
object to be used for this search engine. Use to register additional query parsers with theSRUServer
.params
- additional parameters gathered from the Servlet configuration and Servlet context.- Throws:
SRUConfigException
- an error occurred during initialization of the search engine
-
destroy
public void destroy()
Destroy the search engine. Use this method for any cleanup the search engine needs to perform upon termination.
-
-