public class SearchInfo extends java.lang.Object implements SearchConstants, XmlSerializable
SearchInfo
parses the 'searchrequest' element of a SEARCH
request body and performs basic validation. Both query language and the
query itself can be access from the resulting object.Example of a valid 'searchrequest' body
<d:searchrequest xmlns:d="DAV:" dcr:="http://www.day.com/jcr/webdav/1.0" > <dcr:xpath>//sv:node[@sv:name='myapp:paragraph'][1]</dcr:xpath> </d:searchrequest>Would return the following values:
getLanguageName() -> xpath getQuery() -> //sv:node[@sv:name='myapp:paragraph'][1]
Modifier and Type | Field and Description |
---|---|
static long |
NRESULTS_UNDEFINED |
static long |
OFFSET_UNDEFINED |
BASICSEARCH, HEADER_DASL, NAMESPACE, QUERY_GRAMMER_SET, XML_GRAMMER, XML_QUERY_GRAMMAR, XML_QUERY_SCHEMA_DISCOVERY, XML_SEARCHREQUEST
Constructor and Description |
---|
SearchInfo(java.lang.String language,
Namespace languageNamespace,
java.lang.String query)
Create a new
SearchInfo instance. |
SearchInfo(java.lang.String language,
Namespace languageNamespace,
java.lang.String query,
java.util.Map<java.lang.String,java.lang.String> namespaces)
Create a new
SearchInfo instance. |
Modifier and Type | Method and Description |
---|---|
static SearchInfo |
createFromXml(org.w3c.dom.Element searchRequest)
Create a new
SearchInfo from the specifying document
retrieved from the request body. |
java.lang.String |
getLanguageName()
Returns the name of the query language to be used.
|
Namespace |
getLanguageNameSpace()
Returns the namespace of the language specified with the search request element.
|
java.util.Map<java.lang.String,java.lang.String> |
getNamespaces()
Returns the namespaces that have been re-mapped by the user.
|
long |
getNumberResults()
Returns the maximal number of search results that should be returned.
|
long |
getOffset()
Returns the desired offset in the total result set.
|
java.lang.String |
getQuery()
Return the query string.
|
void |
setNumberResults(long nresults)
Sets the maximal number of search results that should be returned.
|
void |
setOffset(long offset)
Sets the desired offset in the total result set.
|
org.w3c.dom.Element |
toXml(org.w3c.dom.Document document)
Return the xml representation of this
SearchInfo instance. |
public static final long NRESULTS_UNDEFINED
public static final long OFFSET_UNDEFINED
public SearchInfo(java.lang.String language, Namespace languageNamespace, java.lang.String query, java.util.Map<java.lang.String,java.lang.String> namespaces)
SearchInfo
instance.language
- languageNamespace
- query
- namespaces
- the re-mapped namespaces. Key=prefix, value=uri.public SearchInfo(java.lang.String language, Namespace languageNamespace, java.lang.String query)
SearchInfo
instance.language
- languageNamespace
- query
- public java.lang.String getLanguageName()
public Namespace getLanguageNameSpace()
public java.lang.String getQuery()
public java.util.Map<java.lang.String,java.lang.String> getNamespaces()
public long getNumberResults()
public void setNumberResults(long nresults)
nresults
- The maximal number of search resultspublic long getOffset()
public void setOffset(long offset)
offset
- The desired offset in the total result set.public org.w3c.dom.Element toXml(org.w3c.dom.Document document)
SearchInfo
instance.toXml
in interface XmlSerializable
document
- public static SearchInfo createFromXml(org.w3c.dom.Element searchRequest) throws DavException
SearchInfo
from the specifying document
retrieved from the request body.searchRequest
- DavException
- if the root element's name is other than
'searchrequest' or if it does not contain a single child element specifying
the query language to be used.Copyright © 2010 - 2020 Adobe. All Rights Reserved