Class PropertiesSynonymProvider
- java.lang.Object
-
- org.apache.jackrabbit.core.query.lucene.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 Summary
Constructors Constructor Description PropertiesSynonymProvider()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String[]
getSynonyms(String term)
Returns an array of terms that are considered synonyms for the giventerm
.void
initialize(FileSystemResource fsr)
Initializes the synonym provider and passes the file system resource to the synonym provider configuration defined by the configuration value of thesynonymProviderConfigPath
parameter.
-
-
-
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 thesynonymProviderConfigPath
parameter. The resource may benull
if the configuration parameter is not set.- Specified by:
initialize
in interfaceSynonymProvider
- 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 giventerm
.- Specified by:
getSynonyms
in interfaceSynonymProvider
- Parameters:
term
- a search term.- Returns:
- an array of synonyms for the given
term
or an empty array if no synonyms are known.
-
-