public abstract class SearchResultBase extends Object implements SearchResultInterface
| Modifier and Type | Field and Description |
|---|---|
protected String |
_baseUrl |
protected String |
_database |
protected String |
_searchQuery |
protected byte[] |
_searchResponseBytes |
protected Document |
_searchResponseDocument |
protected String |
_searchResponseString |
protected String |
_sessionId |
| Constructor and Description |
|---|
SearchResultBase()
Constructor
|
| Modifier and Type | Method and Description |
|---|---|
void |
addItem(MatchItem item)
Add a MatchItem object
|
boolean |
canPaginate()
Can this display be paginated (next/previous pages for display)?
|
boolean |
expectedNodeCount(NodeList nodeList,
int expected)
Verify we have the expected number of Elements in a Node list
|
String |
getFullUrl(String urlFragment)
Form a full URL (protocol, server, arguments) from a provided URL
and a previously provided base URL
|
String |
getFullUrl(String baseUrl,
String urlFragment)
Form a full URL (protocol, server, arguments) from a base URL and
provided parameters
|
String |
getImageAttribute(Element parent,
String name)
Locate select attribute of the first matching image
|
int |
getMatchCount()
Return the count of matching items returned
|
String |
getNextPreviewPage()
Fetch the "next preview page" reference (used to paginate results
null if none)
|
String |
getPreviousPreviewPage()
Fetch the "previous preview page" reference (used to paginate results,
null if none)
|
String |
getQuery()
Fetch the original query text
|
Document |
getSearchResponseDocument()
Return search results as a Document
|
String |
getSearchResponseString()
Return search results as a String
|
int |
getSearchStart()
Return the starting item number for this search (one based)
|
void |
initialize(QueryBase query)
Save various attributes of the general search request
|
Iterator |
iterator()
Get an iterator to the result list
|
protected Document |
parseResponse()
Parse the search engine response as HTML.
|
String |
prependProxy(String url,
String proxy)
Prepend proxy string (if not already present)
|
void |
saveBaseUrl(String url)
Save the request URL base (the server portion only)
|
void |
setNextPreviewPage(String reference)
Set the "next preview page" reference
|
void |
setPreviousPreviewPage(String reference)
Set the "previous preview page" reference
|
void |
setSearchStart(int start)
Set the starting item number for this search (one based)
|
void |
setSearchStart(String start)
Set the starting item number for this search (one based)
|
MatchItem[] |
toArray()
Return the MatchItem list as a simple array
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitdoParseprotected String _searchQuery
protected byte[] _searchResponseBytes
protected String _searchResponseString
protected Document _searchResponseDocument
protected String _database
protected String _sessionId
protected String _baseUrl
public void initialize(QueryBase query)
initialize in interface SearchResultInterfacequery - The QueryBase extension that sent the search requestpublic void addItem(MatchItem item)
item - MatchItem to addpublic String getQuery()
getQuery in interface SearchResultInterfacepublic int getSearchStart()
getSearchStart in interface SearchResultInterfacepublic void setSearchStart(int start)
start - Starting item numberpublic void setSearchStart(String start)
start - Starting item numberpublic int getMatchCount()
getMatchCount in interface SearchResultInterfacepublic String getNextPreviewPage()
getNextPreviewPage in interface SearchResultInterfacepublic void setNextPreviewPage(String reference)
reference - Next page referencepublic String getPreviousPreviewPage()
getPreviousPreviewPage in interface SearchResultInterfacepublic void setPreviousPreviewPage(String reference)
reference - Previous page referencepublic boolean canPaginate()
canPaginate in interface SearchResultInterfacepublic Iterator iterator()
iterator in interface SearchResultInterfacepublic MatchItem[] toArray()
public String getSearchResponseString()
getSearchResponseString in interface SearchResultInterfacepublic Document getSearchResponseDocument()
protected Document parseResponse() throws SearchException
initialize() (override as reqired)SearchExceptionpublic void saveBaseUrl(String url)
url - Request URL (with or without parameters)public String getFullUrl(String baseUrl, String urlFragment)
baseUrl - The base (or template) URLurlFragment - The (possibly) relative URL to be combined with the basepublic String getFullUrl(String urlFragment)
urlFragment - The (possibly) relative URL to be combined with the basepublic String prependProxy(String url, String proxy)
url - Target URLproxy - Proxy specificationpublic boolean expectedNodeCount(NodeList nodeList, int expected)
nodeList - List of collected Elementsexpected - Number of Elements we expect to seeCopyright © 2003–2020 Sakai Project. All rights reserved.