Package org.dspace.app.util.service
Interface OpenSearchService
-
- All Known Implementing Classes:
OpenSearchServiceImpl
public interface OpenSearchServiceUtility Class with static methods for producing OpenSearch-compliant search results, and the OpenSearch description document.OpenSearch is a specification for describing and advertising search-engines and their result formats. Commonly, RSS and Atom formats are used, which the current implementation supports, as is HTML (used directly in browsers). NB: this is baseline OpenSearch, no extensions currently supported.
The value of the "scope" parameter should either be absent (which means no scope restriction), or the handle of a community or collection.
- Author:
- Richard Rodgers
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description StringgetContentType(String format)Returns a mime-type associated with passed formatStringgetDescription(String scope)Returns OpenSearch Servic Document as a stringDocumentgetDescriptionDoc(String scope)Returns the OpenSearch service document appropriate for given scopeList<String>getFormats()Returns list of supported formatsDocumentgetResultsDoc(Context context, String format, String query, int totalResults, int start, int pageSize, IndexableObject scope, List<IndexableObject> results, Map<String,String> labels)Returns a formatted set of search results as a documentStringgetResultsString(Context context, String format, String query, int totalResults, int start, int pageSize, IndexableObject scope, List<IndexableObject> results, Map<String,String> labels)Returns a formatted set of search results as a stringbooleanisEnabled()Determine if the module is activeDSpaceObjectresolveScope(Context context, String scope)
-
-
-
Method Detail
-
getFormats
List<String> getFormats()
Returns list of supported formats- Returns:
- list of format names - 'rss', 'atom' or 'html'
-
isEnabled
boolean isEnabled()
Determine if the module is active- Returns:
- boolean indicator if the OpenSearch module is enabled or not
-
getContentType
String getContentType(String format)
Returns a mime-type associated with passed format- Parameters:
format- the results document format (rss, atom, html)- Returns:
- content-type mime-type
-
getDescriptionDoc
Document getDescriptionDoc(String scope) throws IOException
Returns the OpenSearch service document appropriate for given scope- Parameters:
scope- - null for entire repository, or handle or community or collection- Returns:
- document the service document
- Throws:
IOException- if IO error
-
getDescription
String getDescription(String scope)
Returns OpenSearch Servic Document as a string- Parameters:
scope- - null for entire repository, or handle or community or collection- Returns:
- service document as a string
-
getResultsString
String getResultsString(Context context, String format, String query, int totalResults, int start, int pageSize, IndexableObject scope, List<IndexableObject> results, Map<String,String> labels) throws IOException
Returns a formatted set of search results as a string- Parameters:
context- DSpace Contextformat- results format - html, rss or atomquery- - the search querytotalResults- - the hit countstart- - start result indexpageSize- - page sizescope- - search scope, null or the community/collectionresults- the retreived DSpace objects satisfying searchlabels- labels to apply - format specific- Returns:
- formatted search results
- Throws:
IOException- if IO error
-
getResultsDoc
Document getResultsDoc(Context context, String format, String query, int totalResults, int start, int pageSize, IndexableObject scope, List<IndexableObject> results, Map<String,String> labels) throws IOException
Returns a formatted set of search results as a document- Parameters:
context- DSpace Contextformat- results format - html, rss or atomquery- - the search querytotalResults- - the hit countstart- - start result indexpageSize- - page sizescope- - search scope, null or the community/collectionresults- the retreived DSpace objects satisfying searchlabels- labels to apply - format specific- Returns:
- formatted search results
- Throws:
IOException- if IO error
-
resolveScope
DSpaceObject resolveScope(Context context, String scope) throws SQLException
- Throws:
SQLException
-
-