001: /*
002: * File : $Source: /usr/local/cvs/opencms/src/org/opencms/search/CmsSearchAnalyzer.java,v $
003: * Date : $Date: 2008-02-27 12:05:38 $
004: * Version: $Revision: 1.12 $
005: *
006: * This library is part of OpenCms -
007: * the Open Source Content Management System
008: *
009: * Copyright (c) 2002 - 2008 Alkacon Software GmbH (http://www.alkacon.com)
010: *
011: * This library is free software; you can redistribute it and/or
012: * modify it under the terms of the GNU Lesser General Public
013: * License as published by the Free Software Foundation; either
014: * version 2.1 of the License, or (at your option) any later version.
015: *
016: * This library is distributed in the hope that it will be useful,
017: * but WITHOUT ANY WARRANTY; without even the implied warranty of
018: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
019: * Lesser General Public License for more details.
020: *
021: * For further information about Alkacon Software GmbH, please see the
022: * company website: http://www.alkacon.com
023: *
024: * For further information about OpenCms, please see the
025: * project website: http://www.opencms.org
026: *
027: * You should have received a copy of the GNU Lesser General Public
028: * License along with this library; if not, write to the Free Software
029: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
030: */
031:
032: package org.opencms.search;
033:
034: import org.opencms.i18n.CmsLocaleManager;
035:
036: import java.util.Locale;
037:
038: /**
039: * An analyzer class is used by Lucene to reduce the content to be indexed
040: * with trimmed endings etc.<p>
041: *
042: * @author Thomas Weckert
043: *
044: * @version $Revision: 1.12 $
045: *
046: * @since 6.0.0
047: */
048: public class CmsSearchAnalyzer {
049:
050: /** The class name of the analyzer. */
051: private String m_className;
052:
053: /** A locale as a key to select the analyzer. */
054: private Locale m_locale;
055:
056: /** The stemmer algorithm to be used. */
057: private String m_stemmerAlgorithm;
058:
059: /**
060: * Returns the className.<p>
061: *
062: * @return the className
063: */
064: public String getClassName() {
065:
066: return m_className;
067: }
068:
069: /**
070: * Returns the locale.<p>
071: *
072: * @return the locale
073: */
074: public Locale getLocale() {
075:
076: return m_locale;
077: }
078:
079: /**
080: * Returns the locale as a String.<p>
081: *
082: * @return the locale as a String
083: *
084: * @see #getLocale()
085: */
086: public String getLocaleString() {
087:
088: return getLocale().toString();
089: }
090:
091: /**
092: * Returns the stemmer algorithm.<p>
093: *
094: * @return the stemmer algorithm
095: */
096: public String getStemmerAlgorithm() {
097:
098: return m_stemmerAlgorithm;
099: }
100:
101: /**
102: * Sets the class name.<p>
103: *
104: * @param className the class name
105: */
106: public void setClassName(String className) {
107:
108: m_className = className;
109: }
110:
111: /**
112: * Sets the locale.<p>
113: *
114: * @param locale the locale
115: */
116: public void setLocale(Locale locale) {
117:
118: m_locale = locale;
119: }
120:
121: /**
122: * Sets the locale as a String.<p>
123: *
124: * @param locale the locale
125: *
126: * @see #setLocale(Locale)
127: */
128: public void setLocaleString(String locale) {
129:
130: setLocale(CmsLocaleManager.getLocale(locale));
131: }
132:
133: /**
134: * Sets the stemmer algorithm.<p>
135: *
136: * @param stemmerAlgorithm the stemmer algorithm
137: */
138: public void setStemmerAlgorithm(String stemmerAlgorithm) {
139:
140: m_stemmerAlgorithm = stemmerAlgorithm;
141: }
142: }
|