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

java.lang.Object
  extended by fr.gouv.culture.sdx.utils.AbstractSdxObject
      extended by fr.gouv.culture.sdx.search.lucene.Field
All Implemented Interfaces:
Describable, Encodable, Identifiable, Localizable, SdxObject, java.io.Serializable, org.apache.avalon.framework.configuration.Configurable, org.apache.avalon.framework.context.Contextualizable, org.apache.avalon.framework.logger.LogEnabled, org.apache.avalon.framework.service.Serviceable, org.apache.excalibur.xml.sax.XMLizable

public class Field
extends AbstractSdxObject
implements org.apache.avalon.framework.logger.LogEnabled, org.apache.avalon.framework.context.Contextualizable, org.apache.avalon.framework.configuration.Configurable, java.io.Serializable

A field for indexing.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from interface fr.gouv.culture.sdx.utils.SdxObject
SdxObject.ConfigurationNode
 
Field Summary
static java.lang.String CLASS_NAME_SUFFIX
          String representation of the pipeline class name suffix.
static int DATE
          Field type "date".
static int FIELD
          Field type "field"
static int UNINDEXED
          Field type "unindexed".
static int WORD
          Field type "word".
static int XML
          Field type "xml".
 
Fields inherited from class fr.gouv.culture.sdx.utils.AbstractSdxObject
_configuration, _description, _encoding, _id, _locale, _logger, _manager, _xmlizable_objects, _xmlLang, isToSaxInitialized
 
Fields inherited from interface fr.gouv.culture.sdx.utils.Encodable
DEFAULT_ENCODING
 
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 contextualize(org.apache.avalon.framework.context.Context context)
           
 void enableLogging(org.apache.avalon.framework.logger.Logger logger)
          Set's the super.getLog() for the field.
 Analyzer getAnalyzer()
          Provides access to the analyzer for this field.
protected  java.lang.String getClassNameSuffix()
          Sub classes should element this method to return their class name suffix for SAX output
 java.lang.String getCode()
          Returns the field's code (name)
 java.text.Collator getCollator()
          Returns a collator for sorting this field.
protected  org.apache.avalon.framework.context.DefaultContext getContext()
           
 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.
 boolean getStoreTermVector()
           
 java.lang.String getTypeName()
          Returns the type Name of the field.
protected  boolean initToSax()
          Init the LinkedHashMap _xmlizable_objects with the objects in order to describ them in XML
protected  void initVolatileObjectsToSax()
          Init the LinkedHashMap _xmlizable_volatile_objects with the objects in order to describ them in XML Some objects need to be refresh each time a toSAX is called
 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 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 fr.gouv.culture.sdx.utils.AbstractSdxObject
configureDescription, getBaseAttributes, getConfiguration, getDescription, getEncoding, getId, getLog, getServiceManager, getXmlLang, service, setDescription, setEncoding, setId, setLocale, setUpSdxObject, setUpSdxObject, setXmlLang, toSAX, verifyConfigurationResources
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CLASS_NAME_SUFFIX

public static final java.lang.String CLASS_NAME_SUFFIX
String representation of the pipeline class name suffix.

See Also:
Constant Field Values

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

XML

public static final int XML
Field type "xml".

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

getClassNameSuffix

protected java.lang.String getClassNameSuffix()
Description copied from class: AbstractSdxObject
Sub classes should element this method to return their class name suffix for SAX output

Specified by:
getClassNameSuffix in class AbstractSdxObject

enableLogging

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

Specified by:
enableLogging in interface org.apache.avalon.framework.logger.LogEnabled
Overrides:
enableLogging in class AbstractSdxObject
Parameters:
logger - The super.getLog() to use

contextualize

public void contextualize(org.apache.avalon.framework.context.Context context)
                   throws org.apache.avalon.framework.context.ContextException
Specified by:
contextualize in interface org.apache.avalon.framework.context.Contextualizable
Overrides:
contextualize in class AbstractSdxObject
Throws:
org.apache.avalon.framework.context.ContextException

getContext

protected org.apache.avalon.framework.context.DefaultContext getContext()
Overrides:
getContext in class AbstractSdxObject

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
Overrides:
configure in class AbstractSdxObject
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.
Returns:
org.apache.lucene.document.Field
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.

Specified by:
getLocale in interface Localizable
Overrides:
getLocale in class AbstractSdxObject
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)

isInBrief

public boolean isInBrief()

getStoreTermVector

public boolean getStoreTermVector()

initToSax

protected boolean initToSax()
Description copied from class: AbstractSdxObject
Init the LinkedHashMap _xmlizable_objects with the objects in order to describ them in XML

Specified by:
initToSax in class AbstractSdxObject

initVolatileObjectsToSax

protected void initVolatileObjectsToSax()
Init the LinkedHashMap _xmlizable_volatile_objects with the objects in order to describ them in XML Some objects need to be refresh each time a toSAX is called

Specified by:
initVolatileObjectsToSax in class AbstractSdxObject


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