Class SearchTemplates


  • public class SearchTemplates
    extends Object
    Contains a list of common search filter templates that can be formatted for any given query.
    • Field Detail

      • filterTemplates

        private final String[] filterTemplates
        Search filter templates.
      • searchRestrictions

        private String searchRestrictions
        Appended to every search filter to restrict results.
    • Constructor Detail

      • SearchTemplates

        public SearchTemplates​(String... templates)
        Creates a new search templates.
        Parameters:
        templates - list of search filters
    • Method Detail

      • getSearchRestrictions

        public String getSearchRestrictions()
        Returns the filter to use for search restrictions.
        Returns:
        search restrictions
      • setSearchRestrictions

        public void setSearchRestrictions​(String restrictions)
        Sets the filter to use for search restrictions.
        Parameters:
        restrictions - search restrictions
      • getTermParsers

        public SearchTemplates.TermParser[] getTermParsers()
        Returns the term parsers used for creating filter parameters.
        Returns:
        term parsers
      • setTermParsers

        public void setTermParsers​(SearchTemplates.TermParser... parsers)
        Sets the term parsers used for creating filter parameters.
        Parameters:
        parsers - term parsers
      • format

        public FilterTemplate[] format​(Query query)
        Creates the filter templates using configured templates and the supplied query.
        Parameters:
        query - to create search filter with
        Returns:
        filter templates
      • concatFilters

        private String concatFilters​(String... filters)
        Concatenates the supplied filters into a single filter will all arguments ANDED together. Null array values are ignored.
        Parameters:
        filters - to concatenate
        Returns:
        search filter