used in the application can be set as well since the search operation is transactional and if it
uses the SpringSyncTransaction, a spring based transaction must be in process.
- Author:
- kimchy
| Fields inherited from class org.springframework.web.servlet.mvc.BaseCommandController |
DEFAULT_COMMAND_NAME |
| Fields inherited from class org.springframework.web.servlet.support.WebContentGenerator |
HEADER_CACHE_CONTROL, HEADER_EXPIRES, HEADER_PRAGMA, METHOD_GET, METHOD_HEAD, METHOD_POST |
| Fields inherited from class org.springframework.context.support.ApplicationObjectSupport |
logger |
|
Method Summary |
void |
afterPropertiesSet()
|
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 before 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()
Sets the page size for the pagination of the results. |
String |
getSearchResultsName()
Returns the name of the results that the CompassSearchResults
will be saved under. |
String |
getSearchResultsView()
Returns the view which will show the results of the search operation. |
String |
getSearchView()
Returns the view that holds the screen which the user will initiate the
search operation. |
protected org.springframework.web.servlet.ModelAndView |
handle(HttpServletRequest request,
HttpServletResponse response,
Object command,
org.springframework.validation.BindException errors)
|
protected CompassSearchResults |
performSearch(CompassSearchCommand searchCommand,
CompassSession session)
|
void |
setPageSize(Integer pageSize)
Returns the page size for the pagination of the results. |
void |
setSearchResultsName(String searchResultsName)
Sets the name of the results that the CompassSearchResults will
be saved under. |
void |
setSearchResultsView(String resultsView)
Sets the view which will show the results of the search operation. |
void |
setSearchView(String searchView)
Sets the view that holds the screen which the user will initiate the
search operation. |
| Methods inherited from class org.springframework.web.servlet.mvc.AbstractCommandController |
handleRequestInternal |
| Methods inherited from class org.springframework.web.servlet.mvc.BaseCommandController |
bindAndValidate, checkCommand, createBinder, createCommand, getBindingErrorProcessor, getCommand, getCommandClass, getCommandName, getMessageCodesResolver, getPropertyEditorRegistrars, getValidator, getValidators, initApplicationContext, initBinder, isValidateOnBinding, onBind, onBind, onBindAndValidate, setBindingErrorProcessor, setCommandClass, setCommandName, setMessageCodesResolver, setPropertyEditorRegistrars, setValidateOnBinding, setValidator, setValidators, suppressBinding, suppressValidation, useDirectFieldAccess |
| Methods inherited from class org.springframework.web.servlet.mvc.AbstractController |
handleRequest, isSynchronizeOnSession, setSynchronizeOnSession |
| Methods inherited from class org.springframework.web.servlet.support.WebContentGenerator |
applyCacheSeconds, applyCacheSeconds, cacheForSeconds, cacheForSeconds, checkAndPrepare, checkAndPrepare, getCacheSeconds, getSupportedMethods, isRequireSession, isUseCacheControlHeader, isUseExpiresHeader, preventCaching, setCacheSeconds, setRequireSession, setSupportedMethods, setUseCacheControlHeader, setUseExpiresHeader |
| Methods inherited from class org.springframework.web.context.support.WebApplicationObjectSupport |
getServletContext, getTempDir, getWebApplicationContext, isContextRequired, setServletContext |
| Methods inherited from class org.springframework.context.support.ApplicationObjectSupport |
getApplicationContext, getMessageSourceAccessor, requiredContextClass, setApplicationContext |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
CompassSearchController
public CompassSearchController()
afterPropertiesSet
public void afterPropertiesSet()
throws Exception
- Specified by:
afterPropertiesSet in interface org.springframework.beans.factory.InitializingBean- Overrides:
afterPropertiesSet in class AbstractCompassCommandController
- Throws:
Exception
handle
protected org.springframework.web.servlet.ModelAndView handle(HttpServletRequest request,
HttpServletResponse response,
Object command,
org.springframework.validation.BindException errors)
throws Exception
- Specified by:
handle in class org.springframework.web.servlet.mvc.AbstractCommandController
- Throws:
Exception
performSearch
protected CompassSearchResults performSearch(CompassSearchCommand searchCommand,
CompassSession session)
buildQuery
protected CompassQuery buildQuery(CompassSearchCommand searchCommand,
CompassSession session)
- Acts as an extension point for search controller that wish to build
different CompassQueries. The default implementation 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.
doProcessBeforeDetach
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.
doProcessAfterDetach
protected void doProcessAfterDetach(CompassSearchCommand searchCommand,
CompassSession session,
CompassDetachedHits hits)
- An option to perform any type of processing before the hits are detached.
getSearchView
public String getSearchView()
- Returns the view that holds the screen which the user will initiate the
search operation.
setSearchView
public void setSearchView(String searchView)
- Sets the view that holds the screen which the user will initiate the
search operation.
getSearchResultsName
public String getSearchResultsName()
- Returns the name of the results that the
CompassSearchResults
will be saved under. Defaults to "searchResults".
setSearchResultsName
public void setSearchResultsName(String searchResultsName)
- Sets the name of the results that the
CompassSearchResults will
be saved under. Defaults to "searchResults".
getSearchResultsView
public String getSearchResultsView()
- Returns the view which will show the results of the search operation.
setSearchResultsView
public void setSearchResultsView(String resultsView)
- Sets the view which will show the results of the search operation.
getPageSize
public Integer getPageSize()
- Sets the page size for the pagination of the results. If not set, not
pagination will be used.
setPageSize
public void setPageSize(Integer pageSize)
- Returns the page size for the pagination of the results. If not set, not
pagination will be used.
- Parameters:
pageSize -
Copyright (c) 2004-2006 The Compass Project.