Class SchemaService


  • public class SchemaService
    extends Object
    The IndexSchemaService provides the index Schema.

    The schema is defined by the following properties:

    • index.fields - content which will be indexed
    • index.fields.analyze - fields indexed as analyzed keyword fields
    • index.fields.noanalyze - fields indexed without analyze
    • index.fields.store - fields stored in the index
    • index.fields.category - fields indexed as categories for a faceted search
    • index.operator - default operator
    • index.splitwhitespace - split text on whitespace prior to analysis
    Version:
    1.0
    Author:
    rsoika
    • Field Detail

      • DEFAULT_SEARCH_FIELD_LIST

        public static List<String> DEFAULT_SEARCH_FIELD_LIST
      • DEFAULT_NOANALYZE_FIELD_LIST

        public static List<String> DEFAULT_NOANALYZE_FIELD_LIST
      • DEFAULT_STORE_FIELD_LIST

        public static List<String> DEFAULT_STORE_FIELD_LIST
      • DEFAULT_CATEGORY_FIELD_LIST

        public static List<String> DEFAULT_CATEGORY_FIELD_LIST
    • Constructor Detail

      • SchemaService

        public SchemaService()
    • Method Detail

      • getFieldList

        public List<String> getFieldList()
        Returns the field list defining the default content of the schema. The values of those items are only searchable by fulltext search
        Returns:
      • getFieldListAnalyze

        public List<String> getFieldListAnalyze()
        Returns the analyzed field list of the schema. The values of those items are searchable by a field search. The values are analyzed.
        Returns:
      • getFieldListNoAnalyze

        public List<String> getFieldListNoAnalyze()
        Returns the no-analyze field list of the schema. The values of those items are searchable by field search. The values are not analyzed.
        Returns:
      • getFieldListStore

        public List<String> getFieldListStore()
        Returns the field list of items stored in the index.
        Returns:
      • getUniqueFieldList

        public Set<String> getUniqueFieldList()
        Returns a unique list of all fields part of the index schema.
        Returns:
      • getFieldListCategory

        public List<String> getFieldListCategory()
        Returns the field list of category fields.
        Returns:
      • getConfiguration

        public ItemCollection getConfiguration()
        Returns the Lucene schema configuration
        Returns:
      • getExtendedSearchTerm

        public String getExtendedSearchTerm​(String sSearchTerm)
                                     throws QueryException
        Returns the extended search term for a given query. The search term will be extended with a users roles to test the read access level of each workitem matching the search term.
        Parameters:
        sSearchTerm -
        Returns:
        extended search term
        Throws:
        QueryException - in case the searchtem is not understandable.
      • escapeSearchTerm

        public String escapeSearchTerm​(String searchTerm,
                                       boolean ignoreBracket)
        This helper method escapes special characters found in a lucene search term. The method can be used by clients to prepare a search phrase.

        Special characters are characters that are part of the lucene query syntax

        + - && || ! ( ) { } [ ] ^ " ~ * ? : \ /

        Clients should use the method normalizeSearchTerm() instead of escapeSearchTerm() to prepare a user input for a lucene search.

        Parameters:
        searchTerm -
        ignoreBracket - - if true brackes will not be escaped.
        Returns:
        escaped search term
        See Also:
        normalizeSearchTerm(java.lang.String)
      • escapeSearchTerm

        public String escapeSearchTerm​(String searchTerm)
      • normalizeSearchTerm

        public String normalizeSearchTerm​(String searchTerm)
        This method normalizes a search term. The method can be used by clients to prepare a search phrase. The serach term will be lowercased and special characters will be replaced by a blank separator

        e.g. 'europe/berlin' will be normalized to 'europe berlin'

        In case the searchTerm contains numbers the method escapes special characters instead of replacing with a blank:

        e.g. 'r-555/333' will be converted into 'r\-555\/333'

        Special characters are characters that are part of the lucene query syntax

        + - && || ! ( ) { } [ ] ^ " ~ ? : \ /

        Parameters:
        searchTerm -
        Returns:
        normalized search term