public final class Search
extends java.lang.Object
Search
class implements the search logic used in the
foundation search component and exposes the query result in a scripting
friendly object structure.
This class does a fulltext query, which means wildcards like '*' and '?' will
be filtered out. Please use QueryBuilder
or execute a query directly
on the JCR Session if wildcard support is needed.Modifier and Type | Class and Description |
---|---|
class |
Search.Hit
A hit within the search result.
|
class |
Search.Page
A result page.
|
class |
Search.Result
A search result.
|
Constructor and Description |
---|
Search(SlingHttpServletRequest request)
Creates a new search based on the given
request . |
Modifier and Type | Method and Description |
---|---|
java.lang.String |
getExcerptPropertyNames()
Deprecated.
since 5.2. Excerpt properties can now only be specified in
the configuration of the QueryBuilder interface. For 5.3,
when Jackrabbit 1.5 is used, the excerpt properties can be
configured in the repository.
|
long |
getHitsPerPage() |
java.lang.String |
getQuery() |
java.util.List<java.lang.String> |
getRelatedQueries() |
Search.Result |
getResult() |
java.lang.String |
getSearchIn() |
java.lang.String |
getSearchProperties() |
Trends |
getTrends() |
void |
setExcerptPropertyNames(java.lang.String properties)
Deprecated.
since 5.2. Excerpt properties can now only be specified in
the configuration of the QueryBuilder interface. For 5.3,
when Jackrabbit 1.5 is used, the excerpt properties can be
configured in the repository.
|
void |
setHitsPerPage(long num) |
void |
setQuery(java.lang.String query)
Sets a new fulltext query that will be executed.
|
void |
setSearchIn(java.lang.String searchIn) |
void |
setSearchProperties(java.lang.String properties) |
public Search(SlingHttpServletRequest request)
request
.request
- the current request.public Trends getTrends()
public Search.Result getResult() throws RepositoryException
null
if there is neither a query
parameter set nor a tag predicate.RepositoryException
- if an exception occurs while executing the
query.public java.util.List<java.lang.String> getRelatedQueries() throws RepositoryException
RepositoryException
- if an error occurs while reading from
the repository.public java.lang.String getQuery()
public void setQuery(java.lang.String query)
query
- the fulltext query.@Deprecated public java.lang.String getExcerptPropertyNames()
@Deprecated public void setExcerptPropertyNames(java.lang.String properties)
properties
- comma separated names of the properties that will be used in
an excerpt.public long getHitsPerPage()
public void setHitsPerPage(long num)
num
- the number of hits to display on a page.public java.lang.String getSearchIn()
public void setSearchIn(java.lang.String searchIn)
searchIn
- the location where to search in.public java.lang.String getSearchProperties()
public void setSearchProperties(java.lang.String properties)
properties
- comma separated names of the properties that will be searched."Copyright © 2010 - 2020 Adobe Systems Incorporated. All Rights Reserved"