fr.gouv.culture.sdx.search.lucene
Class Field

java.lang.Object
  extended byfr.gouv.culture.sdx.search.lucene.Field
All Implemented Interfaces:
org.apache.avalon.framework.configuration.Configurable, org.apache.avalon.framework.logger.LogEnabled, java.io.Serializable

public class Field
extends java.lang.Object
implements org.apache.avalon.framework.logger.LogEnabled, org.apache.avalon.framework.configuration.Configurable, java.io.Serializable

A field for indexing.

See Also:
Serialized Form

Field Summary
static int DATE
          Field type "date".
static int FIELD
          Field type "field"
static int UNINDEXED
          Field type "unindexed".
static int WORD
          Field type "word".
 
Constructor Summary
Field()
          Constructor to satisfy needs of RMI and Serializable implementation
 
Method Summary
 void configure(org.apache.avalon.framework.configuration.Configuration configuration)
          Configures the field
 void enableLogging(org.apache.avalon.framework.logger.Logger logger)
          Set's the logger for the field.
 Analyzer getAnalyzer()
          Provides access to the analyzer for this field.
 java.lang.String getCode()
          Returns the field's code (name)
 java.text.Collator getCollator()
          Returns a collator for sorting this field.
 int getFieldType()
          Returns the type of the field.
 java.util.Locale getLocale()
          Provides access to the locale for this field.
 org.apache.lucene.document.Field getLuceneField(java.lang.String content)
          Returns the Lucene field for the search field.
 java.lang.String getTypeName()
          Returns the type Name of the field.
 boolean isDefault()
          Indicates if this field is defined as a default field.
 boolean isInBrief()
           
 void setAnalyzer(Analyzer analyzer)
           
 void setFieldType(java.lang.String type)
          Sets the type for this field
 void setProperties(java.util.Hashtable props)
          Sets the properties object.
 void setUp(java.util.Locale locale, Analyzer analyzer, java.lang.String analyzerClass, java.lang.String analyzerConfFile)
          Builds a field object with params
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

WORD

public static final int WORD
Field type "word".

See Also:
Constant Field Values

FIELD

public static final int FIELD
Field type "field"

See Also:
Constant Field Values

DATE

public static final int DATE
Field type "date".

See Also:
Constant Field Values

UNINDEXED

public static final int UNINDEXED
Field type "unindexed".

See Also:
Constant Field Values
Constructor Detail

Field

public Field()
Constructor to satisfy needs of RMI and Serializable implementation

Method Detail

setUp

public void setUp(java.util.Locale locale,
                  Analyzer analyzer,
                  java.lang.String analyzerClass,
                  java.lang.String analyzerConfFile)
Builds a field object with params

Parameters:
locale - The locale to use as a default if none specified in the configuration
analyzer - The default analyzer to use if none specified in the configuration
analyzerClass - The fully qualified class name to use as a default
analyzerConfFile - The anlayzer configuration file path to use as a default

enableLogging

public void enableLogging(org.apache.avalon.framework.logger.Logger logger)
Set's the logger for the field.

Specified by:
enableLogging in interface org.apache.avalon.framework.logger.LogEnabled
Parameters:
logger - The logger to use

configure

public void configure(org.apache.avalon.framework.configuration.Configuration configuration)
               throws org.apache.avalon.framework.configuration.ConfigurationException
Configures the field

Specified by:
configure in interface org.apache.avalon.framework.configuration.Configurable
Parameters:
configuration -
Throws:
org.apache.avalon.framework.configuration.ConfigurationException

getAnalyzer

public Analyzer getAnalyzer()
Provides access to the analyzer for this field.

Returns:
The analyzer for this field.

setAnalyzer

public void setAnalyzer(Analyzer analyzer)

getCode

public java.lang.String getCode()
Returns the field's code (name)


getLuceneField

public org.apache.lucene.document.Field getLuceneField(java.lang.String content)
                                                throws SDXException
Returns the Lucene field for the search field. In the case of a field of type "date", if the contents can be interpreted as a date it will be inserted this way, if not it will be inserted like a field of type "keyword".

Parameters:
content - The field's content.
Throws:
SDXException

isDefault

public boolean isDefault()
Indicates if this field is defined as a default field.


getFieldType

public int getFieldType()
Returns the type of the field.


getTypeName

public java.lang.String getTypeName()
Returns the type Name of the field.


getLocale

public java.util.Locale getLocale()
Provides access to the locale for this field.

Returns:

getCollator

public java.text.Collator getCollator()
Returns a collator for sorting this field.


setFieldType

public void setFieldType(java.lang.String type)
Sets the type for this field

Parameters:
type - The field type as a string from our configuration object (element in app.xconf)

setProperties

public void setProperties(java.util.Hashtable props)
Sets the properties object.

Parameters:
props - The properties object

isInBrief

public boolean isInBrief()


Copyright © 2000-2004 Ministere de la culture et de la communication / AJLSM. All Rights Reserved.