Package com.jalios.jcms.policy
Class BasicLuceneSearchEnginePolicyFilter
- java.lang.Object
 - 
- com.jalios.jcms.policy.AbstractPolicyFilter
 - 
- com.jalios.jcms.policy.BasicLuceneSearchEnginePolicyFilter
 
 
 
- 
- All Implemented Interfaces:
 PluginComponent,LuceneSearchEnginePolicyFilter,PolicyFilter,java.lang.Comparable
- Direct Known Subclasses:
 MediaTracksSearchEnginePolicyFilter
public class BasicLuceneSearchEnginePolicyFilter extends AbstractPolicyFilter implements LuceneSearchEnginePolicyFilter, PluginComponent
This class allow developers to put hooks to change lucene search engine mechanism behaviour. To get more information about the current request in hooks, the method Channel#getCurrentJcmsContext() must be called.- Since:
 - jcms-5.7.0
 - Version:
 - $Revision: 92461 $
 - Author:
 - Jean-Philippe Encausse
 
 
- 
- 
Field Summary
Fields Modifier and Type Field Description static java.lang.StringREVISION- 
Fields inherited from class com.jalios.jcms.policy.AbstractPolicyFilter
order 
 - 
 
- 
Constructor Summary
Constructors Constructor Description BasicLuceneSearchEnginePolicyFilter() 
- 
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidfilterCategoryDocument(org.apache.lucene.document.Document doc, Category cat, java.lang.String lang)This method is called when the given Category is being index in the given language, just before writing the Document into the index.voidfilterMemberDocument(org.apache.lucene.document.Document doc, Member mbr)This method is called when the given Member is being index, just before writing the Document into the index.voidfilterPublicationDocument(org.apache.lucene.document.Document doc, Publication pub, java.lang.String lang)This method is called when the given Publication is being index in the given language, just before writing the Document into the index.org.apache.lucene.analysis.AnalyzergetAnalyzer(java.lang.String lang, boolean isIndexing, org.apache.lucene.analysis.Analyzer analyser)Return the Lucene Analyzer to use for a given language.java.util.HashSet<java.lang.String>getLanguageStopWordsSet(java.lang.String lang, java.util.HashSet<java.lang.String> jcms)Retrieves stop words of the specified language.booleaninit(Plugin plugin)Initialize the component with the given plugin configurationorg.apache.lucene.search.QueryparseQuery(java.lang.String searchString, ParseOptions options, org.apache.lucene.analysis.Analyzer analyzer, org.apache.lucene.search.Query query)Parse the specified search string into a Lucene Query.- 
Methods inherited from class com.jalios.jcms.policy.AbstractPolicyFilter
compareTo, equals, getOrder, setOrder 
 - 
 
 - 
 
- 
- 
Field Detail
- 
REVISION
public static final java.lang.String REVISION
- See Also:
 - Constant Field Values
 
 
 - 
 
- 
Method Detail
- 
init
public boolean init(Plugin plugin)
Description copied from interface:PluginComponentInitialize the component with the given plugin configuration- Specified by:
 initin interfacePluginComponent- Parameters:
 plugin- the calling plugin- Returns:
 - true if the component has been correctly initialized.
 - Since:
 - jcms-5.7.1
 - See Also:
 PluginComponent.init(Plugin)
 
- 
getLanguageStopWordsSet
public java.util.HashSet<java.lang.String> getLanguageStopWordsSet(java.lang.String lang, java.util.HashSet<java.lang.String> jcms)Description copied from interface:LuceneSearchEnginePolicyFilterRetrieves stop words of the specified language.- Specified by:
 getLanguageStopWordsSetin interfaceLuceneSearchEnginePolicyFilter- Parameters:
 lang- a ISO-639 language codejcms- the default Set stop word configured in JCMS- Returns:
 - a Set of stop words String
 - See Also:
 LuceneSearchEnginePolicyFilter.getLanguageStopWordsSet(String, HashSet)
 
- 
getAnalyzer
public org.apache.lucene.analysis.Analyzer getAnalyzer(java.lang.String lang, boolean isIndexing, org.apache.lucene.analysis.Analyzer analyser)Description copied from interface:LuceneSearchEnginePolicyFilterReturn the Lucene Analyzer to use for a given language.- Specified by:
 getAnalyzerin interfaceLuceneSearchEnginePolicyFilter- Parameters:
 lang- the ISO-639 code of the language analyzedisIndexing- true if the returned anallyzer is to be used for indexing, false in any other case (e.g. during search etc..) You may want to use this parameter to change the behaviour of your analyzer during those case (for example, synonym analyzer must generate synonyms only when indexing, not during search).analyser- the internal Analyzer, created by JCMS, that should be returned if you do not want to return a customize analyzer- Returns:
 - a new Analyzer
 - See Also:
 LuceneSearchEnginePolicyFilter.getAnalyzer(String, boolean, Analyzer)
 
- 
filterPublicationDocument
public void filterPublicationDocument(org.apache.lucene.document.Document doc, Publication pub, java.lang.String lang)Description copied from interface:LuceneSearchEnginePolicyFilterThis method is called when the given Publication is being index in the given language, just before writing the Document into the index. You can use this hook to modify the Document as you wish by adding or removing field.- Specified by:
 filterPublicationDocumentin interfaceLuceneSearchEnginePolicyFilter- Parameters:
 doc- the lucene Document that was created by JCMS search enginepub- thePublicationbeing indexedlang- the indexed language- See Also:
 LuceneSearchEnginePolicyFilter.filterPublicationDocument(Document, Publication, String)
 
- 
filterCategoryDocument
public void filterCategoryDocument(org.apache.lucene.document.Document doc, Category cat, java.lang.String lang)Description copied from interface:LuceneSearchEnginePolicyFilterThis method is called when the given Category is being index in the given language, just before writing the Document into the index. You can use this hook to modify the Document as you wish by adding or removing field.- Specified by:
 filterCategoryDocumentin interfaceLuceneSearchEnginePolicyFilter- Parameters:
 doc- the lucene Document that was created by JCMS search enginecat- theCategorybeing indexedlang- the indexed language- See Also:
 LuceneSearchEnginePolicyFilter.filterCategoryDocument(Document, Category, String)
 
- 
filterMemberDocument
public void filterMemberDocument(org.apache.lucene.document.Document doc, Member mbr)Description copied from interface:LuceneSearchEnginePolicyFilterThis method is called when the given Member is being index, just before writing the Document into the index. You can use this hook to modify the Document as you wish by adding or removing field.- Specified by:
 filterMemberDocumentin interfaceLuceneSearchEnginePolicyFilter- Parameters:
 doc- the lucene Document that was created by JCMS search enginembr- theMemberbeing indexed- See Also:
 LuceneSearchEnginePolicyFilter.filterMemberDocument(Document, Member)
 
- 
parseQuery
public org.apache.lucene.search.Query parseQuery(java.lang.String searchString, ParseOptions options, org.apache.lucene.analysis.Analyzer analyzer, org.apache.lucene.search.Query query) throws org.apache.lucene.queryparser.classic.ParseExceptionDescription copied from interface:LuceneSearchEnginePolicyFilterParse the specified search string into a Lucene Query.- Specified by:
 parseQueryin interfaceLuceneSearchEnginePolicyFilter- Parameters:
 searchString- the string to be searchoptions- current parsing optionanalyzer- the analyzer being used for this searchquery- a Query instance already computed by other policy if any (may be null)- Returns:
 - a new Query, return null to use default JCMS behavior
 - Throws:
 org.apache.lucene.queryparser.classic.ParseException- on parse error- See Also:
 LuceneSearchEnginePolicyFilter.parseQuery(String, ParseOptions, Analyzer, Query)
 
 - 
 
 -