fr.gouv.culture.sdx.thesaurus
Class LuceneThesaurus

java.lang.Object
  extended by fr.gouv.culture.sdx.utils.AbstractSdxObject
      extended by fr.gouv.culture.sdx.utils.database.DatabaseBacked
          extended by fr.gouv.culture.sdx.documentbase.AbstractDocumentBase
              extended by fr.gouv.culture.sdx.documentbase.SDXDocumentBase
                  extended by fr.gouv.culture.sdx.documentbase.LuceneDocumentBase
                      extended by fr.gouv.culture.sdx.thesaurus.LuceneThesaurus
All Implemented Interfaces:
DocumentBase, SDXDocumentBaseTarget, Searchable, SDXThesaurus, Thesaurus, Describable, Encodable, Identifiable, Localizable, Saveable, SdxObject, Target, 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 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.


Nested Class Summary
 
Nested classes/interfaces inherited from interface fr.gouv.culture.sdx.thesaurus.SDXThesaurus
SDXThesaurus.ConfigurationNode
 
Nested classes/interfaces inherited from interface fr.gouv.culture.sdx.documentbase.SDXDocumentBaseTarget
SDXDocumentBaseTarget.ConfigurationNode
 
Field Summary
protected  int defaultDepth
           
protected  int[] defaultRelations
           
static java.lang.String FIELD_NAME_FTERM
          Two field names
static java.lang.String FIELD_NAME_FUF
           
protected  org.apache.excalibur.source.impl.URLSource source
           
 
Fields inherited from class fr.gouv.culture.sdx.documentbase.LuceneDocumentBase
_fieldList, _xmlFieldList, DBELEM_ATTRIBUTE_REMOTE_ACCESS, ELEMENT_NAME_LUCENE_SDX_INTERNAL_FIELDS, INDEX_DIR_CURRENT, INDEX_DIR_MAIN, lastDocCount, luceneActiveIndex, luceneCurrentIndex, luceneSearchIndexList, SEARCH_INDEX_DIRECTORY_NAME, subIndexCount
 
Fields inherited from class fr.gouv.culture.sdx.documentbase.SDXDocumentBase
_configuration, _documentAdditionStatus, _ilevel, _ilogger, _isIndexOptimized, autoOptimize, baseIndexDir, DOC_ADD_STATUS_ADDED, DOC_ADD_STATUS_FAILURE, DOC_ADD_STATUS_IGNORED, DOC_ADD_STATUS_REFRESHED, DOC_ADD_STATUS_REPLACED, DOC_URL, ELEMENT_NAME_DEFAULT_HPP, ELEMENT_NAME_DEFAULT_MAXSORT, isDatadirShared, keepOriginalDocuments, scheduler, SDX_DATABASE_FORMAT, SDX_DATABASE_VERSION, SDX_DATABASE_VERSION_2_3, SDX_DATE, SDX_DATE_MILLISECONDS, SDX_ISO8601_DATE, SDX_USER, splitActive, splitDoc, splitSize, splitUnit, useCompoundFiles
 
Fields inherited from class fr.gouv.culture.sdx.documentbase.AbstractDocumentBase
_indexationPipeline, _oaiHarv, ATTRIBUTE_AUTO_OPTIMIZE, ATTRIBUTE_COMPOUND_FILES, ATTRIBUTE_SPLIT_DOC, ATTRIBUTE_SPLIT_SIZE, ATTRIBUTE_SPLIT_UNIT, DBELEM_ATTRIBUTE_DEFAULT, DBELEM_ATTRIBUTE_HPP, DBELEM_ATTRIBUTE_KEEP_ORIGINAL, DBELEM_ATTRIBUTE_MAXSORT, defaultHitsPerPage, defaultMaxSort, defaultRepository, ELEMENT_NAME_INDEX_SPLIT, ELEMENT_NAME_OPTIMIZE, 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, oaiRepo, oaiRepositories, 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, useMetadata
 
Fields inherited from class fr.gouv.culture.sdx.utils.database.DatabaseBacked
_database, CLASS_NAME_SUFFIX, DATABASE_DIR_NAME, databaseConf, dbLocation, dbPath, DEFAULT_DATABASE_TYPE
 
Fields inherited from class fr.gouv.culture.sdx.utils.AbstractSdxObject
_context, _description, _encoding, _id, _locale, _logger, _manager, _xmlizable_objects, _xmlLang, isToSaxInitialized
 
Fields inherited from interface fr.gouv.culture.sdx.thesaurus.SDXThesaurus
CLASS_NAME_SUFFIX, PACKAGE_QUALNAME
 
Fields inherited from interface fr.gouv.culture.sdx.thesaurus.Thesaurus
NAMESPACE_PREFIX, 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.utils.Encodable
DEFAULT_ENCODING
 
Fields inherited from interface fr.gouv.culture.sdx.utils.save.Saveable
ALL_SAVE_ATTRIB, PATH_ATTRIB, SAVE_DIRECTORY_PARAM
 
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.
protected  void configureBase(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 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.
 java.lang.String getRelationTypeAbbreviation(int type)
          Returns an abbreviation String for a relation type defined in the thesaurus
 int getRelationTypeInt(java.lang.String abbr)
          Returns an int for a relation type String defined in the thesaurus
protected  org.apache.avalon.framework.configuration.Configuration[] getRepositoryConfigurationList(org.apache.avalon.framework.configuration.Configuration configuration)
          Configures repositories
 void init()
          Initializes the document base.
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
 void load()
          Loads a thesaurus in memory.
 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 unload()
          Unloads the memory representation of the thesaurus.
 
Methods inherited from class fr.gouv.culture.sdx.documentbase.LuceneDocumentBase
addSubIndex, addSubIndex, addToSearchIndex, backup, backupIndexes, backupTimeStamp, compactSearchIndex, configureDocumentBase, configureFieldList, configureOAIHarvester, configureOAIRepositories, configureOAIRepository, configureSearchIndex, createOAIRepository, createOAIRepository, createOAIRepository, creationDate, delete, deleteFromSearchIndex, docCount, getFormatedSubIndexId, getIndex, getIndexationDocument, getIndexReader, getIndexSize, getLuceneIndex, getSearcher, getXMLFieldList, index, indexModified, initializeVectorizedIndex, lastModificationDate, mergeBatch, mergeCurrentBatch, optimize, reloadFieldList, removeSubIndex, renewKeyIndex, replaceFieldList, restore, restoreIndexes, restoreTimeStamp, setBaseParameters, setSearchIndexParameters, splitCheck, splitIndex
 
Methods inherited from class fr.gouv.culture.sdx.documentbase.SDXDocumentBase
add, checkIntegrity, configureIdGenerator, configureOAIComponents, configureOptimizeTriggers, configureRepositories, configureSplit, delete, deleteIndexableDocumentComponents, deleteRelationsToMastersFromDatabase, getByteSplitSize, getConfiguration, getDocument, getDocument, getDocument, getDocument, getIndexationInformations, getIndexationLogger, getOwners, getRelated, getRepositoryForDocument, getRepositoryForStorage, getSplitDoc, getSplitSize, getSplitUnit, getUseCompoundFiles, handleParameters, index, index, isAutoOptimized, isIndexOptimized, rollbackIndexation, setConfiguration, targetTriggered
 
Methods inherited from class fr.gouv.culture.sdx.documentbase.AbstractDocumentBase
addOaiDeletedRecord, addOAIRepository, configurePipeline, createEntityForDocMetaData, delete, deletePhysicalDocument, getDefaultHitsPerPage, getDefaultMaxSort, getDefaultOAIRepository, getDefaultRepository, getIdGenerator, getIndexationPipeline, getMimeType, getOAIHarvester, getOAIRepositoriesSize, getOAIRepository, getOAIRepository, getPooledRepositoryConnection, getRepository, getSourceValidity, isDefault, isUseMetadata, managedOaiDeletedRecord, optimizeDatabase, optimizeRepositories, releasePooledRepositoryConnections, removeOaiDeletedRecord
 
Methods inherited from class fr.gouv.culture.sdx.utils.database.DatabaseBacked
configure, getClassNameSuffix, getDatabase
 
Methods inherited from class fr.gouv.culture.sdx.utils.AbstractSdxObject
configureDescription, contextualize, enableLogging, getBaseAttributes, getContext, getDescription, getEncoding, getId, getLocale, 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
 
Methods inherited from interface fr.gouv.culture.sdx.documentbase.DocumentBase
checkIntegrity, createOAIRepository, creationDate, delete, delete, getDefaultHitsPerPage, getDefaultMaxSort, getDefaultRepository, getDocument, getDocument, getDocument, getDocument, getIndexationPipeline, getMimeType, getOAIHarvester, getOAIRepositoriesSize, getOAIRepository, getOAIRepository, getRepository, getSourceValidity, index, index, isDefault, lastModificationDate, optimize
 
Methods inherited from interface fr.gouv.culture.sdx.utils.SdxObject
getLog
 
Methods inherited from interface org.apache.avalon.framework.logger.LogEnabled
enableLogging
 
Methods inherited from interface org.apache.avalon.framework.context.Contextualizable
contextualize
 
Methods inherited from interface org.apache.avalon.framework.service.Serviceable
service
 
Methods inherited from interface fr.gouv.culture.sdx.utils.Identifiable
getId, setId
 
Methods inherited from interface fr.gouv.culture.sdx.utils.Describable
getDescription, setDescription
 
Methods inherited from interface fr.gouv.culture.sdx.utils.Encodable
getEncoding, setEncoding
 
Methods inherited from interface fr.gouv.culture.sdx.utils.Localizable
getLocale, getXmlLang, setLocale, setXmlLang
 
Methods inherited from interface org.apache.excalibur.xml.sax.XMLizable
toSAX
 
Methods inherited from interface fr.gouv.culture.sdx.search.Searchable
getId, getIndex
 
Methods inherited from interface fr.gouv.culture.sdx.utils.save.Saveable
backup, restore
 

Field Detail

defaultDepth

protected int defaultDepth

defaultRelations

protected int[] defaultRelations

source

protected org.apache.excalibur.source.impl.URLSource source

FIELD_NAME_FTERM

public static final java.lang.String FIELD_NAME_FTERM
Two field names

See Also:
Constant Field Values

FIELD_NAME_FUF

public static final java.lang.String FIELD_NAME_FUF
See Also:
Constant Field Values
Constructor Detail

LuceneThesaurus

public LuceneThesaurus()
Method Detail

configureBase

protected void configureBase(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:
configureBase 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
Description copied from class: SDXDocumentBase
Configures repositories

Overrides:
getRepositoryConfigurationList in class SDXDocumentBase
Returns:
Throws:
org.apache.avalon.framework.configuration.ConfigurationException

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.

Parameters:
source - The SAX input source where the thesaurus is.

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

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 super.getLog() has been set and the configuration done.

Specified by:
init in interface DocumentBase
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

getRelationTypeAbbreviation

public java.lang.String getRelationTypeAbbreviation(int type)
Description copied from interface: Thesaurus
Returns an abbreviation String for a relation type defined in the thesaurus

Specified by:
getRelationTypeAbbreviation in interface Thesaurus

getRelationTypeInt

public int getRelationTypeInt(java.lang.String abbr)
Description copied from interface: Thesaurus
Returns an int for a relation type String defined in the thesaurus

Specified by:
getRelationTypeInt in interface Thesaurus

initToSax

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

Overrides:
initToSax in class LuceneDocumentBase

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

Overrides:
initVolatileObjectsToSax in class LuceneDocumentBase


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