Class PropertiesSynonymProvider

  • All Implemented Interfaces:
    SynonymProvider

    public class PropertiesSynonymProvider
    extends Object
    implements SynonymProvider
    Implements a synonym provider based on a properties file. Each line in the properties file is treated as a synonym definition. Example:
     A=B
     B=C
     
    This synonym provider will return B as a synonym for A and vice versa. The same applies to B and C. However A is not considered a synonym for C, nor C a synonym for A.
    • Constructor Detail

      • PropertiesSynonymProvider

        public PropertiesSynonymProvider()
    • Method Detail

      • initialize

        public void initialize​(FileSystemResource fsr)
                        throws IOException
        Initializes the synonym provider and passes the file system resource to the synonym provider configuration defined by the configuration value of the synonymProviderConfigPath parameter. The resource may be null if the configuration parameter is not set.
        Specified by:
        initialize in interface SynonymProvider
        Parameters:
        fsr - the file system resource to the synonym provider configuration.
        Throws:
        IOException - if an error occurs while initializing the synonym provider.
      • getSynonyms

        public String[] getSynonyms​(String term)
        Returns an array of terms that are considered synonyms for the given term.
        Specified by:
        getSynonyms in interface SynonymProvider
        Parameters:
        term - a search term.
        Returns:
        an array of synonyms for the given term or an empty array if no synonyms are known.