Interface SearchRequestHandler

All Known Subinterfaces:
SearchFilterHandler, SearchFormHandler
All Known Implementing Classes:
CombinedSearchFormAndSearchFilterHandler, ManualQueryAndSearchFilterHandler, ScoredHandler, SearchFilterHandlerImpl, SearchFormAndQueryHandler, SearchFormHandlerImpl

public interface SearchRequestHandler

A search request handler is asked to create a query for a client search request. The handler may return null to indicate that it cannot handle the request.

The search handlers are used as follows. At first the score of each handler is computed. Then they are iterated from hightest to lowest priority and the first non-null search query is finally returned. All other handlers are discarded.

Impl notes to Scores:

We use a score of 100 to specify handling a "normal" request. Any value higher than that is considered to be a more special request handler. For example, if a search filter is present, the handler for search filters will return 100, as this is his default request. The same applies to SearchFormHandler which will return 100, if a search form is present. Then there is a more specialized handler for using both search filter and search form. This handler now needs to have both values set, the others just care for one - so if both values are present, it must return a higher score than 100. Look at the existing implementations when choosing the score to return.

  • Method Details

    • getScore

      int getScore(SearchRequest request)
      Returns the priority of this handler. The most positive score is considered as highest priority. The higher the score, the more specialized this handler is in handling the request. This is called on every search!
    • createSearchQuery

      @Nullable @Nullable SearchQueryResponse createSearchQuery(SearchRequest request) throws RpcExecutionException
      Returns the search query for this search request.