public class OpenSearchServiceImpl extends Object implements OpenSearchService
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.
| Modifier and Type | Field and Description |
|---|---|
protected ConfigurationService |
configurationService |
protected HandleService |
handleService |
protected String |
osNs |
| Modifier | Constructor and Description |
|---|---|
protected |
OpenSearchServiceImpl() |
| Modifier and Type | Method and Description |
|---|---|
protected String |
getBaseSearchServiceURL()
Get base search service URL (websvc.opensearch.svccontext)
|
protected String |
getBaseSearchUIURL()
Get base search UI URL (websvc.opensearch.uicontext)
|
String |
getContentType(String format)
Returns a mime-type associated with passed format
|
String |
getDescription(String scope)
Returns OpenSearch Servic Document as a string
|
Document |
getDescriptionDoc(String scope)
Returns the OpenSearch service document appropriate for given scope
|
List<String> |
getFormats()
Returns list of supported formats
|
protected SyndicationFeed |
getResults(Context context,
String format,
String query,
int totalResults,
int start,
int pageSize,
IndexableObject scope,
List<IndexableObject> results,
Map<String,String> labels) |
Document |
getResultsDoc(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 document
|
String |
getResultsString(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 string
|
protected org.jdom.Document |
getServiceDocument(String scope)
Returns as a document the OpenSearch service document
|
boolean |
isEnabled()
Determine if the module is active
|
protected Document |
jDomToW3(org.jdom.Document jdomDoc)
Converts a JDOM document to a W3C one
|
protected com.sun.syndication.feed.module.opensearch.OpenSearchModule |
openSearchMarkup(String query,
int totalResults,
int start,
int pageSize) |
DSpaceObject |
resolveScope(Context context,
String scope) |
protected final String osNs
@Autowired(required=true) protected ConfigurationService configurationService
@Autowired(required=true) protected HandleService handleService
public List<String> getFormats()
OpenSearchServicegetFormats in interface OpenSearchServicepublic boolean isEnabled()
OpenSearchServiceisEnabled in interface OpenSearchServiceprotected String getBaseSearchServiceURL()
protected String getBaseSearchUIURL()
public String getContentType(String format)
OpenSearchServicegetContentType in interface OpenSearchServiceformat - the results document format (rss, atom, html)public Document getDescriptionDoc(String scope) throws IOException
OpenSearchServicegetDescriptionDoc in interface OpenSearchServicescope - - null for entire repository, or handle or community or collectionIOException - if IO errorpublic String getDescription(String scope)
OpenSearchServicegetDescription in interface OpenSearchServicescope - - null for entire repository, or handle or community or collectionpublic 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
OpenSearchServicegetResultsString in interface OpenSearchServicecontext - 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 specificIOException - if IO errorpublic 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
OpenSearchServicegetResultsDoc in interface OpenSearchServicecontext - 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 specificIOException - if IO errorprotected SyndicationFeed getResults(Context context, String format, String query, int totalResults, int start, int pageSize, IndexableObject scope, List<IndexableObject> results, Map<String,String> labels)
protected com.sun.syndication.feed.module.opensearch.OpenSearchModule openSearchMarkup(String query, int totalResults, int start, int pageSize)
protected org.jdom.Document getServiceDocument(String scope)
scope - - null for the entire repository, or a collection/community handleprotected Document jDomToW3(org.jdom.Document jdomDoc) throws IOException
jdomDoc - jDOM document to convertIOException - if IO errorpublic DSpaceObject resolveScope(Context context, String scope) throws SQLException
resolveScope in interface OpenSearchServiceSQLExceptionCopyright © 2019 DuraSpace. All rights reserved.