[opencms-dev] Configure OpenCms Lucene / Analyzer / Stemmer to allow any substring in search

Mathias Lin mail at mathiaslin.com
Mon Oct 15 11:40:32 CEST 2012


Is there an easy way in OpenCms to configure the search / lucene that
a search by any substring of a string within a document would be
considered a match.

For example, I have a document title like "Security Audit Briefing"

Searching for:
"security" -> returns above document as a result
"secur" -> returns above document as a result
"securi" -> does NOT return above document as a result !!!

I want the analyzer/stemmer to also allow 'securi' to be a valid search phrase.

My current analyzer and stemmer is Snowball, which is already a bit
more flexible than the StandardAnalyzer, but I'd like it to accept any
matching substring, not just valid 'syllables':

            <analyzer>

<class>org.apache.lucene.analysis.snowball.SnowballAnalyzer</class>
		<stemmer>English</stemmer>
                <locale>en</locale>
            </analyzer>

Is there any very flexible analyzer/stemmer already available for
OpenCms and a way to configure it in opencms-search.xml ? Or do I need
to customize the underlying Lucene on a lower level?

Thanks, M.



More information about the opencms-dev mailing list