source: SRUServer/trunk/src/main/java/eu/clarin/sru/server/SRUSearchEngine.java @ 6934

Last change on this file since 6934 was 6934, checked in by Oliver Schonefeld, 8 years ago
  • Property svn:eol-style set to native
File size: 4.6 KB
Line 
1/**
2 * This software is copyright (c) 2011-2016 by
3 *  - Institut fuer Deutsche Sprache (http://www.ids-mannheim.de)
4 * This is free software. You can redistribute it
5 * and/or modify it under the terms described in
6 * the GNU General Public License v3 of which you
7 * should have received a copy. Otherwise you can download
8 * it from
9 *
10 *   http://www.gnu.org/licenses/gpl-3.0.txt
11 *
12 * @copyright Institut fuer Deutsche Sprache (http://www.ids-mannheim.de)
13 *
14 * @license http://www.gnu.org/licenses/gpl-3.0.txt
15 *  GNU General Public License v3
16 */
17package eu.clarin.sru.server;
18
19/**
20 * Interface for connecting the SRU protocol implementation to an actual search
21 * engine.
22 * <p>
23 * Implementing the
24 * {@link #explain(SRUServerConfig, SRURequest, SRUDiagnosticList)} and
25 * {@link #scan(SRUServerConfig, SRURequest, SRUDiagnosticList)} is optional,
26 * but implementing
27 * {@link #search(SRUServerConfig, SRURequest, SRUDiagnosticList)} is mandatory.
28 * </p>
29 * <p>
30 * The implementation of these methods <em>must</em> be thread-safe.
31 * </p>
32 */
33public interface SRUSearchEngine {
34
35    /**
36     * Handle an <em>explain</em> operation. Implementing this method is
37     * optional, but is required, if the <em>writeExtraResponseData</em> block
38     * of the SRU response needs to be filled. The arguments for this operation
39     * are provides by the {@link SRURequest} object.
40     * <p>
41     * The implementation of this method <em>must</em> be thread-safe.
42     * </p>
43     *
44     * @param config
45     *            the <code>SRUEndpointConfig</code> object that contains the
46     *            endpoint configuration
47     * @param request
48     *            the <code>SRURequest</code> object that contains the request
49     *            made to the endpoint
50     * @param diagnostics
51     *            the <code>SRUDiagnosticList</code> object for storing
52     *            non-fatal diagnostics
53     * @return a <code>SRUExplainResult</code> object or <code>null</code> if
54     *         the search engine does not want to provide
55     *         <em>writeExtraResponseData</em>
56     * @throws SRUException
57     *             if an fatal error occurred
58     * @see SRUExplainResult
59     */
60    public SRUExplainResult explain(SRUServerConfig config, SRURequest request,
61            SRUDiagnosticList diagnostics) throws SRUException;
62
63
64    /**
65     * Handle a <em>searchRetrieve</em> operation. Implementing this method is
66     * mandatory. The arguments for this operation are provides by the
67     * {@link SRURequest} object.
68     * <p>
69     * The implementation of this method <em>must</em> be thread-safe.
70     * </p>
71     *
72     * @param config
73     *            the <code>SRUEndpointConfig</code> object that contains the
74     *            endpoint configuration
75     * @param request
76     *            the <code>SRURequest</code> object that contains the request
77     *            made to the endpoint
78     * @param diagnostics
79     *            the <code>SRUDiagnosticList</code> object for storing
80     *            non-fatal diagnostics
81     * @return a <code>SRUSearchResultSet</code> object
82     * @throws SRUException
83     *             if an fatal error occurred
84     * @see SRURequest
85     * @see SRUExplainResult
86     */
87    public SRUSearchResultSet search(SRUServerConfig config,
88            SRURequest request, SRUDiagnosticList diagnostics)
89            throws SRUException;
90
91
92    /**
93     * Handle a <em>scan</em> operation. Implementing this method is optional.
94     * If you don't need to handle the <em>scan</em> operation, just return
95     * <code>null</code> and the SRU server will return the appropiate
96     * diagnostic to the client. The arguments for this operation are provides
97     * by the {@link SRURequest} object.
98     * <p>
99     * The implementation of this method <em>must</em> be thread-safe.
100     * </p>
101     *
102     * @param config
103     *            the <code>SRUEndpointConfig</code> object that contains the
104     *            endpoint configuration
105     * @param request
106     *            the <code>SRURequest</code> object that contains the request
107     *            made to the endpoint
108     * @param diagnostics
109     *            the <code>SRUDiagnosticList</code> object for storing
110     *            non-fatal diagnostics
111     * @return a <code>SRUScanResultSet</code> object or <code>null</code> if
112     *         this operation is not supported by this search engine
113     * @throws SRUException
114     *             if an fatal error occurred
115     * @see SRUExplainResult
116     */
117    public SRUScanResultSet scan(SRUServerConfig config, SRURequest request,
118            SRUDiagnosticList diagnostics) throws SRUException;
119
120} // interface SRUSearchEngine
Note: See TracBrowser for help on using the repository browser.