org.compass.spring.web.mvc
Class CompassSearchController
java.lang.Object
org.springframework.context.support.ApplicationObjectSupport
org.springframework.web.context.support.WebApplicationObjectSupport
org.springframework.web.servlet.support.WebContentGenerator
org.springframework.web.servlet.mvc.AbstractController
org.springframework.web.servlet.mvc.BaseCommandController
org.springframework.web.servlet.mvc.AbstractCommandController
org.compass.spring.web.mvc.AbstractCompassCommandController
org.compass.spring.web.mvc.CompassSearchController
- All Implemented Interfaces:
- org.springframework.beans.factory.InitializingBean, org.springframework.context.ApplicationContextAware, org.springframework.web.context.ServletContextAware, org.springframework.web.servlet.mvc.Controller
public class CompassSearchController
- extends AbstractCompassCommandController
A general Spring's MVC Controller that perform the search operation of Compass.
Will perform the search operation on the Compass instance using the query supplied
by the CompassSearchCommand.
Pagination can be enabled by setting the pageSize property on the controller,
as well as providing the page number property on the CompassSearchCommand.
The controller has two views to be set, the searchView, which is the view that
holds the screen which the user will initiate the search operation, and the
searchResultsView, which will show the results of the search operation (they can be
the same page).
The results of the search operation will be saved under the searchResultsName,
which defaults to "searchResults".
In order to extend and execute additional operations during the search process
CompassSearchHelper should be extended and
set using setSearchHelper(org.compass.core.support.search.CompassSearchHelper).
- 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 |
METHOD_GET, METHOD_HEAD, METHOD_POST |
| Fields inherited from class org.springframework.context.support.ApplicationObjectSupport |
logger |
| 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, getWebBindingInitializer, initApplicationContext, initBinder, isValidateOnBinding, onBind, onBind, onBindAndValidate, prepareBinder, setBindingErrorProcessor, setCommandClass, setCommandName, setMessageCodesResolver, setPropertyEditorRegistrar, setPropertyEditorRegistrars, setValidateOnBinding, setValidator, setValidators, setWebBindingInitializer, suppressBinding, suppressValidation, suppressValidation, 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, isUseCacheControlNoStore, isUseExpiresHeader, preventCaching, setCacheSeconds, setRequireSession, setSupportedMethods, setUseCacheControlHeader, setUseCacheControlNoStore, setUseExpiresHeader |
| Methods inherited from class org.springframework.web.context.support.WebApplicationObjectSupport |
getServletContext, getTempDir, getWebApplicationContext, initApplicationContext, initServletContext, 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(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
Object command,
org.springframework.validation.BindException errors)
throws Exception
- Specified by:
handle in class org.springframework.web.servlet.mvc.AbstractCommandController
- Throws:
Exception
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 - The page size when using paginated results
setSearchHelper
public void setSearchHelper(CompassSearchHelper searchHelper)
The search helper is used to execute teh actual search. By default (if not set)
the search controller will create a new search helper. If provided, the search
controller will use it to perform the search.
Mainly used to extend the search helper and execute additional operation within
specific calbacks the search helper exposes.
- Parameters:
searchHelper - A specific search helper to use
Copyright (c) 2004-2008 The Compass Project.