|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.compass.core.support.search.CompassSearchHelper
public class CompassSearchHelper
A general Search Controller that perform the search operations. The seardch controller is therad safe.
Will perform the search operation on the Compass instance using the query
supplied by the CompassSearchCommand.
Pagination will be enabled if pageSize property is set on the controller,
as well as providing the page number property on the
CompassSearchCommand.
The search controller provides several extension points, including
buildQuery(CompassSearchCommand,org.compass.core.CompassSession),
doProcessBeforeDetach(CompassSearchCommand,org.compass.core.CompassSession,org.compass.core.CompassHits,int,int)
and doProcessAfterDetach(CompassSearchCommand,org.compass.core.CompassSession,org.compass.core.CompassDetachedHits).
| Constructor Summary | |
|---|---|
CompassSearchHelper(Compass compass)
Creates a new compass search helper based on Compass without pagination. |
|
CompassSearchHelper(Compass compass,
Integer pageSize)
Creates a new compass search helper based on Compass with pagination. |
|
| Method Summary | |
|---|---|
protected CompassQuery |
buildQuery(CompassSearchCommand searchCommand,
CompassSession session)
Acts as an extension point for search controller that wish to build different CompassQueries. |
protected void |
doProcessAfterDetach(CompassSearchCommand searchCommand,
CompassSession session,
CompassDetachedHits hits)
An option to perform any type of processing after the hits are detached. |
protected void |
doProcessBeforeDetach(CompassSearchCommand searchCommand,
CompassSession session,
CompassHits hits,
int from,
int size)
An option to perform any type of processing before the hits are detached. |
Integer |
getPageSize()
Returns the page size for the pagination of the results. |
protected CompassSearchResults |
performSearch(CompassSearchCommand searchCommand,
CompassSession session)
Performs the actual search operation. |
CompassSearchResults |
search(CompassSearchCommand command)
|
CompassSearchResults |
searchLocal(CompassSearchCommand command)
|
void |
setPageSize(Integer pageSize)
Sets the page size for the pagination of the results. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public CompassSearchHelper(Compass compass)
compass - The compass instance to use
public CompassSearchHelper(Compass compass,
Integer pageSize)
compass - The Compass instancepageSize - The page size| Method Detail |
|---|
public CompassSearchResults search(CompassSearchCommand command)
throws CompassException
CompassException
public CompassSearchResults searchLocal(CompassSearchCommand command)
throws CompassException
CompassException
protected CompassSearchResults performSearch(CompassSearchCommand searchCommand,
CompassSession session)
buildQuery(CompassSearchCommand,org.compass.core.CompassSession),
doProcessBeforeDetach(CompassSearchCommand,org.compass.core.CompassSession,org.compass.core.CompassHits,int,int)
and doProcessAfterDetach(CompassSearchCommand,org.compass.core.CompassSession,org.compass.core.CompassDetachedHits).
searchCommand - The search command to perform the searchsession - CompassSession to execute the search with
protected CompassQuery buildQuery(CompassSearchCommand searchCommand,
CompassSession session)
Acts as an extension point for search controller that wish to build
different CompassQueries. Since the search command can hold either a
CompassQuery or a query string, will first
check if the CompassQuery is set, and if not,
will use the query search string.
The default implementation when query string is provided uses the session to create a query
builder and use the queryString option, i.e.:
session.queryBuilder().queryString(searchCommand.getQuery().trim()).toQuery();.
Some other interesting options might be to add sorting to the query, adding other queries using a boolean query, or executing a different query.
protected void doProcessBeforeDetach(CompassSearchCommand searchCommand,
CompassSession session,
CompassHits hits,
int from,
int size)
protected void doProcessAfterDetach(CompassSearchCommand searchCommand,
CompassSession session,
CompassDetachedHits hits)
public Integer getPageSize()
public void setPageSize(Integer pageSize)
pageSize - The page size for pagination of the results
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||