fr.gouv.culture.sdx.thesaurus
Class LuceneThesaurus

java.lang.Object
  extended byfr.gouv.culture.sdx.utils.SdxObjectImpl
      extended byfr.gouv.culture.sdx.utils.database.DatabaseBacked
          extended byfr.gouv.culture.sdx.documentbase.AbstractDocumentBase
              extended byfr.gouv.culture.sdx.documentbase.SDXDocumentBase
                  extended byfr.gouv.culture.sdx.documentbase.LuceneDocumentBase
                      extended byfr.gouv.culture.sdx.thesaurus.LuceneThesaurus
All Implemented Interfaces:
org.apache.avalon.framework.component.Composable, org.apache.avalon.framework.configuration.Configurable, org.apache.avalon.framework.context.Contextualizable, DocumentBase, org.apache.avalon.framework.logger.LogEnabled, SdxObject, SDXThesaurus, Searchable, Thesaurus, org.apache.cocoon.xml.XMLizable

public class LuceneThesaurus
extends LuceneDocumentBase
implements SDXThesaurus

A lucene implementation of a thesaurus. This class uses a Lucene index where all concepts are stored as one document, and all relations of a document are stored as fields for the document.


Field Summary
protected  int defaultDepth
           
protected  int[] defaultRelations
           
protected  java.lang.String ELEMENT_NAME_DEPTH
          String representation of the element name
protected  java.lang.String ELEMENT_NAME_RELATION
           
protected  java.lang.String ELEMENT_NAME_RELATIONS
           
protected  org.apache.cocoon.components.source.URLSource source
           
 
Fields inherited from class fr.gouv.culture.sdx.documentbase.LuceneDocumentBase
configuration, DBELEM_ATTRIBUTE_REMOTE_ACCESS, ELEMENT_NAME_FIELD_LIST, ELEMENT_NAME_LUCENE_SDX_INTERNAL_FIELDS, FIELDS_DEFINITION, fieldsDef, luceneSearchIndex, SEARCH_INDEX_DIRECTORY_NAME
 
Fields inherited from class fr.gouv.culture.sdx.documentbase.SDXDocumentBase
_documentAdditionStatus, DOC_ADD_STATUS_ADDED, DOC_ADD_STATUS_FAILURE, DOC_ADD_STATUS_IGNORED, DOC_ADD_STATUS_REFRESHED, DOC_ADD_STATUS_REPLACED, DOC_URL, DOCUMENTBASE_DIR_PATH, keepOriginalDocuments, SDX_DATABASE_FORMAT, SDX_DATABASE_VERSION, SDX_DATABASE_VERSION_2_3, SDX_DATE, SDX_DATE_MILLISECONDS, SDX_ISO8601_DATE, SDX_USER
 
Fields inherited from class fr.gouv.culture.sdx.documentbase.AbstractDocumentBase
context, DBELEM_ATTRIBUTE_DEFAULT, DBELEM_ATTRIBUTE_KEEP_ORIGINAL, defaultRepository, ELEMENT_NAME_INDEX, ELEMENT_NAME_OAI_HARVESTER, ELEMENT_NAME_OAI_REPOSITORY, ELEMENT_NAME_PIPELINE, indexationPipeline, INTERNAL_FIELD_NAME_SDX_OAI_DELETED_RECORD, INTERNAL_FIELD_NAME_SDXALL, INTERNAL_FIELD_NAME_SDXAPPID, INTERNAL_FIELD_NAME_SDXCONTENTLENGTH, INTERNAL_FIELD_NAME_SDXDBID, INTERNAL_FIELD_NAME_SDXDOCID, INTERNAL_FIELD_NAME_SDXDOCTYPE, INTERNAL_FIELD_NAME_SDXMODDATE, INTERNAL_FIELD_NAME_SDXREPOID, INTERNAL_SDXALL_FIELD_VALUE, isDefault, locale, oaiHarv, oaiRepo, PROPERTY_NAME_ATTACHED, PROPERTY_NAME_CONTENT_LENGTH, PROPERTY_NAME_DOCTYPE, PROPERTY_NAME_MIMETYPE, PROPERTY_NAME_ORIGINAL, PROPERTY_NAME_PARENT, PROPERTY_NAME_REPO, PROPERTY_NAME_SUB, repoConnectionPool, repositories
 
Fields inherited from class fr.gouv.culture.sdx.utils.database.DatabaseBacked
_manager, ATTRIBUTE_ID, CLASS_NAME_SUFFIX, database, DATABASE_DIR_NAME, databaseConf, dbLocation, dbPath, DEFAULT_DATABASE_TYPE, ELEMENT_NAME_DATABASE, id, PACKAGE_QUALNAME, props
 
Fields inherited from class fr.gouv.culture.sdx.utils.SdxObjectImpl
encoding, logger
 
Fields inherited from interface fr.gouv.culture.sdx.thesaurus.SDXThesaurus
ATTRIBUTE_ID, ATTRIBUTE_SRC, ATTRIBUTE_TYPE, CLASS_NAME_SUFFIX, ELEMENT_NAME_THESAURI, ELEMENT_NAME_THESAURUS, PACKAGE_QUALNAME
 
Fields inherited from interface fr.gouv.culture.sdx.thesaurus.Thesaurus
NAMESPACE_URI, RELATION_BROADER_TERM, RELATION_BROADER_TERMS, RELATION_EQUIVALENT_TERM, RELATION_NARROWER_TERM, RELATION_PARTIAL_EQIUVALENCE, RELATION_RELATED_TERM, RELATION_SCOPE_NOTE, RELATION_USE, RELATION_USED_FOR
 
Fields inherited from interface fr.gouv.culture.sdx.documentbase.DocumentBase
ELEMENT_NAME_DOCUMENT_BASE, ELEMENT_NAME_DOCUMENT_BASES
 
Constructor Summary
LuceneThesaurus()
           
 
Method Summary
 void addConcept(Concept concept)
          Adds a document.
 void addConcepts(Concept[] concepts)
          Adds a group of documents.
 void build(org.xml.sax.InputSource source)
          Builds a thesaurus from a SAX input source.
 void build(java.lang.String url)
          Builds a thesaurus from a File.
 void compile()
           
 void configure(org.apache.avalon.framework.configuration.Configuration configuration)
          Sets the configuration options for this document base.
 void deleteConcept(Concept concept)
          Removes a concept document with the given id and any sub concepts.
 void deleteConcepts(Concept[] concepts)
          Removes a concept document with the given id and any sub concepts.
 Results expandQuery(Query query)
          Expands a query returning the results of the expanded query
 Results expandQuery(Query query, java.lang.String fieldName)
          Expands a query returning the results of the expanded query
 Results expandQuery(Query query, java.lang.String fieldName, int[] relations, int depth)
          Expands a query returning the results of the expanded query
 Results expandQuery(Query query, java.lang.String fieldName, int[] relations, int depth, java.lang.String[] langs)
          Expands a query returning the results of the expanded query
 Results expandQuery(Query query, java.lang.String fieldName, int relation, int depth)
          Expands a query returning the results of the expanded query
 Concept[] filterByLangs(Concept[] concepts, java.lang.String[] langs)
          Filters concepts by a list of languages
protected  LuceneConcept getConcept(org.apache.lucene.document.Document ldoc)
          Builds a thesaurus from a SAX input source.
 Concept getConceptById(java.lang.String id)
          Returns a document using its id.
 Concept getConceptByName(java.lang.String name)
          Returns a document using its term.
 int getDefaultDepth()
          Return's the default depth for searching relations
 int[] getDefaultRelations()
          Return's the default set of relation int's for searching relations
 Concept[] getRelations(Concept concept)
          Return's related concepts
 Concept[] getRelations(Concept[] concepts)
          Returns related concepts
 Concept[] getRelations(Concept[] concepts, int[] relations, int depth)
          Returns concepts related to a list of concepts.
 Concept[] getRelations(Concept[] concepts, int[] relations, int depth, java.lang.String[] langs)
           
 Concept[] getRelations(Concept[] concepts, int relation, int depth)
          Returns concepts related to a list of concepts.
 Concept[] getRelations(Concept[] concepts, int relation, int depth, java.lang.String[] langs)
          Returns concepts related to a list of concepts, filtered by languages.
 Concept[] getRelations(Concept concept, int[] relations, int depth)
          Returns concepts related to a list of concepts.
 Concept[] getRelations(Concept concept, int[] relations, int depth, java.lang.String[] langs)
           
 Concept[] getRelations(Concept concept, int relation, int depth)
          Returns concepts related to a document.
 Concept[] getRelations(Concept concept, int relation, int depth, java.lang.String[] langs)
          Returns concepts related to a document, filtered by languages.
 Concept[] getRelations(java.lang.String searchTerm, Concept[] concepts, int[] relations, int depth)
          Returns concepts related to a list of concepts.
 Concept[] getRelations(java.lang.String searchTerm, Concept[] concepts, int relation, int depth)
          Returns concepts related to a list of concepts.
 Concept[] getRelations(java.lang.String searchTerm, Concept concept, int[] relations, int depth)
          Returns concepts related to a list of concepts.
 Concept[] getRelations(java.lang.String searchTerm, Concept concept, int relation, int depth)
          Returns concepts related to a document.
protected  org.apache.avalon.framework.configuration.Configuration[] getRepositoryConfigurationList(org.apache.avalon.framework.configuration.Configuration configuration)
           
 void init()
          Initializes the document base.
 void load()
          Loads a thesaurus in memory.
protected  void loadBaseConfiguration(org.apache.avalon.framework.configuration.Configuration configuration)
          Overrides parent method and allows for configuration element <sdx:thesaurus> set's the path for the this thesaurus/document base
 void save()
          Saves the contents.
 Concept[] search(java.lang.String query)
          Searches for concepts.
 long size()
          Returns the number of terms in the thesaurus.
 void toSAX(org.xml.sax.ContentHandler handler)
          If this thesaurus is built from a source file we call toSAX on that source otherwise we call toSAX on the super class
 void unload()
          Unloads the memory representation of the thesaurus.
 
Methods inherited from class fr.gouv.culture.sdx.documentbase.LuceneDocumentBase
addToSearchIndex, compactSearchIndex, configureDocumentBase, configureFieldList, configureOAIHarvester, configureOAIRepository, configureSearchIndex, creationDate, delete, deleteFromSearchIndex, getIndex, getIndexationDocument, lastModificationDate, setBaseParameters, setSearchIndexParameters
 
Methods inherited from class fr.gouv.culture.sdx.documentbase.SDXDocumentBase
add, configureIdGenerator, configureOAIComponents, configureRepositories, delete, deleteIndexableDocumentComponents, deleteRelationsToMastersFromDatabase, getDocument, getDocument, getDocument, getDocument, getOwners, getRelated, getRepositoryForDocument, getRepositoryForStorage, handleParameters, index, index, index, rollbackIndexation
 
Methods inherited from class fr.gouv.culture.sdx.documentbase.AbstractDocumentBase
addOaiDeletedRecord, configurePipeline, contextualize, createEntityForDocMetaData, delete, deletePhysicalDocument, getDefaultRepository, getId, getIndexationPipeline, getMimeType, getOAIHarvester, getOAIRepository, getPooledRepositoryConnection, getRepository, isDefault, optimizeDatabase, optimizeRepositories, releasePooledRepositoryConnections, removeOaiDeletedRecord, setId
 
Methods inherited from class fr.gouv.culture.sdx.utils.database.DatabaseBacked
compose, getDatabase, setProperties
 
Methods inherited from class fr.gouv.culture.sdx.utils.SdxObjectImpl
enableLogging, getChildLogger, setEncoding
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface fr.gouv.culture.sdx.thesaurus.SDXThesaurus
getId, setProperties
 
Methods inherited from interface fr.gouv.culture.sdx.documentbase.DocumentBase
creationDate, delete, delete, getDefaultRepository, getDocument, getDocument, getDocument, getDocument, getIndexationPipeline, getMimeType, getOAIHarvester, getOAIRepository, getRepository, index, index, isDefault, lastModificationDate, setId
 
Methods inherited from interface org.apache.avalon.framework.logger.LogEnabled
enableLogging
 
Methods inherited from interface org.apache.avalon.framework.component.Composable
compose
 
Methods inherited from interface org.apache.avalon.framework.context.Contextualizable
contextualize
 
Methods inherited from interface fr.gouv.culture.sdx.search.Searchable
getIndex
 

Field Detail

defaultDepth

protected int defaultDepth

ELEMENT_NAME_DEPTH

protected final java.lang.String ELEMENT_NAME_DEPTH
String representation of the element name

See Also:
Constant Field Values

ELEMENT_NAME_RELATIONS

protected final java.lang.String ELEMENT_NAME_RELATIONS
See Also:
Constant Field Values

ELEMENT_NAME_RELATION

protected final java.lang.String ELEMENT_NAME_RELATION
See Also:
Constant Field Values

defaultRelations

protected int[] defaultRelations

source

protected org.apache.cocoon.components.source.URLSource source
Constructor Detail

LuceneThesaurus

public LuceneThesaurus()
Method Detail

loadBaseConfiguration

protected void loadBaseConfiguration(org.apache.avalon.framework.configuration.Configuration configuration)
                              throws org.apache.avalon.framework.configuration.ConfigurationException
Overrides parent method and allows for configuration element <sdx:thesaurus> set's the path for the this thesaurus/document base

Overrides:
loadBaseConfiguration in class SDXDocumentBase
Parameters:
configuration -
Throws:
org.apache.avalon.framework.configuration.ConfigurationException

getRepositoryConfigurationList

protected org.apache.avalon.framework.configuration.Configuration[] getRepositoryConfigurationList(org.apache.avalon.framework.configuration.Configuration configuration)
                                                                                            throws org.apache.avalon.framework.configuration.ConfigurationException
Overrides:
getRepositoryConfigurationList in class SDXDocumentBase
Throws:
org.apache.avalon.framework.configuration.ConfigurationException

toSAX

public void toSAX(org.xml.sax.ContentHandler handler)
           throws org.xml.sax.SAXException,
                  org.apache.cocoon.ProcessingException
If this thesaurus is built from a source file we call toSAX on that source otherwise we call toSAX on the super class

Specified by:
toSAX in interface org.apache.cocoon.xml.XMLizable
Overrides:
toSAX in class AbstractDocumentBase
Parameters:
handler - The handler to feed with events
Throws:
org.xml.sax.SAXException
org.apache.cocoon.ProcessingException

size

public long size()
Returns the number of terms in the thesaurus.

Specified by:
size in interface SDXThesaurus

search

public Concept[] search(java.lang.String query)
                 throws SDXException
Searches for concepts.

Specified by:
search in interface SDXThesaurus
Parameters:
query - The concept term, already analyzed by an appropriate analyzer.
Throws:
SDXException

expandQuery

public Results expandQuery(Query query)
                    throws SDXException
Description copied from interface: SDXThesaurus
Expands a query returning the results of the expanded query

Specified by:
expandQuery in interface SDXThesaurus
Parameters:
query - The query object which should be expanded using this thesaurus
Returns:
A results object of the executed expanded query
Throws:
SDXException

expandQuery

public Results expandQuery(Query query,
                           java.lang.String fieldName)
                    throws SDXException
Description copied from interface: SDXThesaurus
Expands a query returning the results of the expanded query

Specified by:
expandQuery in interface SDXThesaurus
Parameters:
query - The query object which should be expanded using this thesaurus
fieldName - The name of field on which expansion should take place
Returns:
A results object of the executed expanded query
Throws:
SDXException

expandQuery

public Results expandQuery(Query query,
                           java.lang.String fieldName,
                           int relation,
                           int depth)
                    throws SDXException
Description copied from interface: SDXThesaurus
Expands a query returning the results of the expanded query

Specified by:
expandQuery in interface SDXThesaurus
Parameters:
query - The query object which should be expanded using this thesaurus
fieldName - The name of field on which expansion should take place
relation - The relation type, for finding terms which should be used to expand the query
depth - The depth to which a relation should be followed, 0 finds the relation withing the matching concept 1, finds the relation within concept for the matching relation found by the "0 case", etc.
Returns:
A results object of the executed expanded query
Throws:
SDXException

expandQuery

public Results expandQuery(Query query,
                           java.lang.String fieldName,
                           int[] relations,
                           int depth)
                    throws SDXException
Description copied from interface: SDXThesaurus
Expands a query returning the results of the expanded query

Specified by:
expandQuery in interface SDXThesaurus
Parameters:
query - The query object which should be expanded using this thesaurus
fieldName - The name of field on which expansion should take place
relations - The relation types, for finding terms which should be used to expand the query
depth - The depth to which a relation should be followed, 0 finds the relation withing the matching concept 1, finds the relation within concept for the matching relation found by the "0 case", etc. * @return A results object of the executed expanded query
Throws:
SDXException

expandQuery

public Results expandQuery(Query query,
                           java.lang.String fieldName,
                           int[] relations,
                           int depth,
                           java.lang.String[] langs)
                    throws SDXException
Description copied from interface: SDXThesaurus
Expands a query returning the results of the expanded query

Specified by:
expandQuery in interface SDXThesaurus
Parameters:
query - The query object which should be expanded using this thesaurus
fieldName - The name of field on which expansion should take place
relations - The relation types, for finding terms which should be used to expand the query
depth - The depth to which a relation should be followed, 0 finds the relation withing the matching concept 1, finds the relation within concept for the matching relation found by the "0 case", etc. * @return A results object of the executed expanded query
Throws:
SDXException

addConcept

public void addConcept(Concept concept)
                throws SDXException
Adds a document.

Specified by:
addConcept in interface SDXThesaurus
Parameters:
concept - The document to add.
Throws:
SDXException

addConcepts

public void addConcepts(Concept[] concepts)
                 throws SDXException
Description copied from interface: SDXThesaurus
Adds a group of documents.

Specified by:
addConcepts in interface SDXThesaurus
Parameters:
concepts - The documents to add.
Throws:
SDXException

deleteConcept

public void deleteConcept(Concept concept)
                   throws SDXException
Removes a concept document with the given id and any sub concepts.

Specified by:
deleteConcept in interface SDXThesaurus
Parameters:
concept - The document.
Throws:
SDXException

deleteConcepts

public void deleteConcepts(Concept[] concepts)
                    throws SDXException
Removes a concept document with the given id and any sub concepts.

Specified by:
deleteConcepts in interface SDXThesaurus
Parameters:
concepts - The documents.
Throws:
SDXException

getRelations

public Concept[] getRelations(Concept[] concepts)
                       throws SDXException
Description copied from interface: SDXThesaurus
Returns related concepts

Specified by:
getRelations in interface SDXThesaurus
Parameters:
concepts - The concepts for which relations are desired
Returns:
Throws:
SDXException

getRelations

public Concept[] getRelations(Concept concept)
                       throws SDXException
Description copied from interface: SDXThesaurus
Return's related concepts

Specified by:
getRelations in interface SDXThesaurus
Parameters:
concept - The concept for which relations are desired
Returns:
Throws:
SDXException

getRelations

public Concept[] getRelations(Concept concept,
                              int relation,
                              int depth)
                       throws SDXException
Returns concepts related to a document.

Specified by:
getRelations in interface SDXThesaurus
Parameters:
concept - The document.
relation - The relation to use.
depth - The depth to which a relation should be evaluated, 0 finds the relation withing the matching concept 1, finds the relation within concept for the matching relation found by the "0 case", etc.
Returns:
Throws:
SDXException

getRelations

public Concept[] getRelations(java.lang.String searchTerm,
                              Concept concept,
                              int relation,
                              int depth)
                       throws SDXException
Returns concepts related to a document.

Specified by:
getRelations in interface SDXThesaurus
Parameters:
searchTerm - The search term which was used to find the concept, in the case that the searchTerm and related concept value are equal the relation value will be returned in as Concept useful for relation fields which are of relation word and would be found by a search(searchTerm)
concept - The document.
relation - The relation to use.
depth - The levels up or down indicating the extent to which the relation search should be executed
Returns:
Throws:
SDXException

getRelations

public Concept[] getRelations(Concept[] concepts,
                              int[] relations,
                              int depth)
                       throws SDXException
Returns concepts related to a list of concepts.

Specified by:
getRelations in interface SDXThesaurus
Parameters:
concepts - The list of concepts.
relations - The relation types.
depth - The depth to which a relation should be evaluated, 0 finds the relation withing the matching concept 1, finds the relation within concept for the matching relation found by the "0 case", etc.
Returns:
Throws:
SDXException

getRelations

public Concept[] getRelations(Concept concept,
                              int[] relations,
                              int depth)
                       throws SDXException
Returns concepts related to a list of concepts.

Specified by:
getRelations in interface SDXThesaurus
Parameters:
concept - The list of concepts.
relations - The relation types.
depth - The depth to which a relation should be evaluated, 0 finds the relation withing the matching concept 1, finds the relation within concept for the matching relation found by the "0 case", etc.
Returns:
Throws:
SDXException

getRelations

public Concept[] getRelations(Concept[] concepts,
                              int relation,
                              int depth)
                       throws SDXException
Returns concepts related to a list of concepts.

Specified by:
getRelations in interface SDXThesaurus
Parameters:
concepts - The list of concepts.
relation - The relation relation .
depth - The depth to which a relation should be evaluated, 0 finds the relation withing the matching concept 1, finds the relation within concept for the matching relation found by the "0 case", etc.
Returns:
Throws:
SDXException

getRelations

public Concept[] getRelations(java.lang.String searchTerm,
                              Concept[] concepts,
                              int relation,
                              int depth)
                       throws SDXException
Returns concepts related to a list of concepts.

Specified by:
getRelations in interface SDXThesaurus
Parameters:
searchTerm - The search term which was used to find the concept
concepts - The list of concepts.
relation - The relation relation .
depth - The levels up or down indicating the extent to which the relation search should be executed
Returns:
Throws:
SDXException

getRelations

public Concept[] getRelations(java.lang.String searchTerm,
                              Concept[] concepts,
                              int[] relations,
                              int depth)
                       throws SDXException
Returns concepts related to a list of concepts.

Specified by:
getRelations in interface SDXThesaurus
Parameters:
searchTerm - The search term which was used to find the concept
concepts - The list of concepts.
relations - The relation types .
depth - The levels up or down indicating the extent to which the relation search should be executed
Returns:
Throws:
SDXException

getRelations

public Concept[] getRelations(java.lang.String searchTerm,
                              Concept concept,
                              int[] relations,
                              int depth)
                       throws SDXException
Returns concepts related to a list of concepts.

Specified by:
getRelations in interface SDXThesaurus
Parameters:
searchTerm - The search term which was used to find the concept
concept - The list of concepts.
relations - The relation types .
depth - The levels up or down indicating the extent to which the relation search should be executed
Returns:
Throws:
SDXException

getConceptByName

public Concept getConceptByName(java.lang.String name)
                         throws SDXException
Returns a document using its term.

Specified by:
getConceptByName in interface SDXThesaurus
Parameters:
name - The document's term name.
Throws:
SDXException

getConceptById

public Concept getConceptById(java.lang.String id)
                       throws SDXException
Returns a document using its id.

Specified by:
getConceptById in interface SDXThesaurus
Parameters:
id - The document's id.
Throws:
SDXException

save

public void save()
Saves the contents.

Specified by:
save in interface SDXThesaurus

load

public void load()
Loads a thesaurus in memory.

Specified by:
load in interface SDXThesaurus

unload

public void unload()
Unloads the memory representation of the thesaurus.

Specified by:
unload in interface SDXThesaurus

getConcept

protected LuceneConcept getConcept(org.apache.lucene.document.Document ldoc)
Builds a thesaurus from a SAX input source.


getRelations

public Concept[] getRelations(Concept concept,
                              int[] relations,
                              int depth,
                              java.lang.String[] langs)
                       throws SDXException
Specified by:
getRelations in interface SDXThesaurus
Throws:
SDXException

getRelations

public Concept[] getRelations(Concept[] concepts,
                              int[] relations,
                              int depth,
                              java.lang.String[] langs)
                       throws SDXException
Specified by:
getRelations in interface SDXThesaurus
Throws:
SDXException

getRelations

public Concept[] getRelations(Concept concept,
                              int relation,
                              int depth,
                              java.lang.String[] langs)
                       throws SDXException
Returns concepts related to a document, filtered by languages.

Specified by:
getRelations in interface SDXThesaurus
Parameters:
concept - The document.
relation - The relation to use.
depth - The depth to which relations should be retrieved
langs - The list of languages for filtering concepts.
Throws:
SDXException

getRelations

public Concept[] getRelations(Concept[] concepts,
                              int relation,
                              int depth,
                              java.lang.String[] langs)
                       throws SDXException
Returns concepts related to a list of concepts, filtered by languages.

Specified by:
getRelations in interface SDXThesaurus
Parameters:
concepts - The list of concepts.
relation - The relation.
depth - The depth to which relations should be retrieved
langs - The list of languages for filtering concepts.
Throws:
SDXException

configure

public void configure(org.apache.avalon.framework.configuration.Configuration configuration)
               throws org.apache.avalon.framework.configuration.ConfigurationException
Description copied from class: LuceneDocumentBase
Sets the configuration options for this document base.

Specified by:
configure in interface org.apache.avalon.framework.configuration.Configurable
Overrides:
configure in class LuceneDocumentBase
Parameters:
configuration - The configuration object from which to build a document base.

Sample configuration entry:

<sdx:documentBase sdx:id = "myDocumentBaseName" sdx:type = "lucene">
       <sdx:fieldList xml:lang = "fr-FR" sdx:variant = "" sdx:analyzerConf = "" sdx:analyzerClass = "">
     <sdx:field code = "fieldName" type = "word" xml:lang = "fr-FR" sdx:analyzerClass = "" sdx:analyzerConf = ""/>
     <sdx:field code = "fieldName2" type = "field" xml:lang = "fr-FR" brief = "true"/>
     <sdx:field code = "fieldName3" type = "date" xml:lang = "fr-FR"/>
     <sdx:field code = "fieldName4" type = "unindexed" xml:lang = "fr-FR"/>
     </sdx:fieldList>
     <sdx:index>
     <sdx:pipeline sdx:id = "sdxIndexationPipeline">
     <sdx:transformation src = "path to stylesheet, can be absolute or relative to the directory containing this file" sdx:id = "step2" sdx:type = "xslt"/>
     <sdx:transformation src = "path to stylesheet, can be absolute or relative to the directory containing this file" sdx:id = "step3" sdx:type = "xslt" keep = "true"/>
     </sdx:pipeline>
     </sdx:index>
     <sdx:repositories>
     <sdx:repository baseDirectory = "blah4" depth = "3" extent = "100" sdx:type = "FS" sdx:default = "true" sdx:id = "blah4"/>
     <sdx:repository ref = "blah2"/>
     </sdx:repositories>
     </sdx:documentBase>
     
Throws:
org.apache.avalon.framework.configuration.ConfigurationException
See Also:
we should link to this in the future when we have better documentation capabilities

getDefaultDepth

public int getDefaultDepth()
Description copied from interface: SDXThesaurus
Return's the default depth for searching relations

Specified by:
getDefaultDepth in interface SDXThesaurus

getDefaultRelations

public int[] getDefaultRelations()
Description copied from interface: SDXThesaurus
Return's the default set of relation int's for searching relations

Specified by:
getDefaultRelations in interface SDXThesaurus

filterByLangs

public Concept[] filterByLangs(Concept[] concepts,
                               java.lang.String[] langs)
Description copied from interface: SDXThesaurus
Filters concepts by a list of languages

Specified by:
filterByLangs in interface SDXThesaurus
Parameters:
concepts - List of concepts for filtering
langs - List of langauages (in xml:lang format) which are desired
Returns:

init

public void init()
          throws SDXException
Description copied from interface: DocumentBase
Initializes the document base.

This method must be called after the logger has been set and the configuration done.

Specified by:
init in interface SDXThesaurus
Overrides:
init in class LuceneDocumentBase
Throws:
SDXException

build

public void build(java.lang.String url)
           throws SDXException,
                  org.apache.avalon.framework.configuration.ConfigurationException
Description copied from interface: SDXThesaurus
Builds a thesaurus from a File.

Specified by:
build in interface SDXThesaurus
Parameters:
url - The url to the file containing the thesaurus.
Throws:
SDXException
org.apache.avalon.framework.configuration.ConfigurationException

build

public void build(org.xml.sax.InputSource source)
           throws SDXException
Description copied from interface: SDXThesaurus
Builds a thesaurus from a SAX input source.

Specified by:
build in interface SDXThesaurus
Parameters:
source - The SAX input source where the thesaurus is.
Throws:
SDXException

compile

public void compile()
             throws SDXException
Specified by:
compile in interface Thesaurus
Throws:
SDXException


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