Issue #00005549

Added possibility to use custom LuceneAnalyser per app

OpenWGA has the possibility to use "language specific analysers" in order to index content depending on the content language.

This setting however is global for the server. If enabled ALL apps will use this.

The are however situation where this is not optimal.

If you have an non-multi-language App (f. e. BAK apps) containing some "backend data" like products, addresses, ... those apps are as well indexed using the analyser of the default language of the App. You probably want them indexed using the "default analyser" that does not change the content when indexing.

Another case is when this non-multi-language App contains content in different languages. But only you knows this. The CMS treats them all as "content in default language".

We now added a new interface class "AnalyzerSelectingLuceneIndexEnhancer" to OpenWGA. This is a special variant of a LuceneIndexEnhancer you can implement and configure to be used is those apps.

The AnalyzerSelectingLuceneIndexEnhancer has one addition method

Analyzer getAnalyzer(WGContent content)

This will be called by OpenWGA and lets you define what analyser should be used for indexing a singe content.


public void init(WGACore core, WGDatabase db) throws WGException {
    _core = core;

public Analyzer getAnalyzer(WGContent content) throws WGAPIException {
    // always use default-analiser in this app
    return _core.getDefaultAnalyzer();

Sample 2:

public Analyzer getAnalyzer(WGContent content) throws WGAPIException {
    // use analyser based on some item value
        String code = content.getItemText("lang_code");
        return _core.getAnalyzerForLanguageCode(code);
    return null;

If the call to getAnalyzer() returns null the default behaviour will be used (language specific or default analyser depending on the global config).