public class OpenSearch extends Object
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.
| Constructor and Description |
|---|
OpenSearch() |
| Modifier and Type | Method and Description |
|---|---|
static String |
getContentType(String format)
Returns a mime-type associated with passed format
|
static String |
getDescription(String scope)
Returns OpenSearch Servic Document as a string
|
static Document |
getDescriptionDoc(String scope)
Returns the OpenSearch service document appropriate for given scope
|
static List<String> |
getFormats()
Returns list of supported formats
|
static Document |
getResultsDoc(String format,
String query,
int totalResults,
int start,
int pageSize,
DSpaceObject scope,
DSpaceObject[] results,
Map<String,String> labels)
Returns a formatted set of search results as a document
|
static String |
getResultsString(String format,
String query,
int totalResults,
int start,
int pageSize,
DSpaceObject scope,
DSpaceObject[] results,
Map<String,String> labels)
Returns a formatted set of search results as a string
|
static DSpaceObject |
resolveScope(Context context,
String scope) |
public static List<String> getFormats()
public static String getContentType(String format)
format - the results document format (rss, atom, html)public static Document getDescriptionDoc(String scope) throws IOException
scope - - null for entire repository, or handle or community or collectionIOExceptionpublic static String getDescription(String scope)
scope - - null for entire repository, or handle or community or collectionpublic static String getResultsString(String format, String query, int totalResults, int start, int pageSize, DSpaceObject scope, DSpaceObject[] results, Map<String,String> labels) throws IOException
format - results format - html, rss or atomquery - - the search querytotalResults - - the hit countstart - - start result indexpageSize - - page sizescope - - search scope, null or community/collection handleresults - the retreived DSpace objects satisfying searchlabels - labels to apply - format specificIOExceptionpublic static Document getResultsDoc(String format, String query, int totalResults, int start, int pageSize, DSpaceObject scope, DSpaceObject[] results, Map<String,String> labels) throws IOException
format - results format - html, rss or atomquery - - the search querytotalResults - - the hit countstart - - start result indexpageSize - - page sizescope - - search scope, null or community/collection handleresults - the retreived DSpace objects satisfying searchlabels - labels to apply - format specificIOExceptionpublic static DSpaceObject resolveScope(Context context, String scope) throws SQLException
SQLExceptionCopyright © 2015 DuraSpace. All Rights Reserved.