org.apache.lucene.gdata.search.config
Class IndexSchema

java.lang.Object
  extended by org.apache.lucene.gdata.search.config.IndexSchema

public class IndexSchema
extends Object

This class is used to configure the indexing and search component. Each service on the GData server will have an own search index. For this purpose one single index schema will be configured in the gdata-config.xml file. This file will be mapped on this class on startup.

This class breaks some encapsulation of general java classes to be configurable via the xml configuration file. The will be very less type and value checking of the properties inside this file. Mandatory values must be set in the configuration file. The server won't start up if these values are missing. See definition in the xml schema file. If this class is instantiated manually the value for the name of the schema should be set before this is passed to the IndexController.

One IndexSchema consists of multiple instances of IndexSchemaField each of this instances describes a single field in the index and all schema informations about the field.

Author:
Simon Willnauer
See Also:
IndexSchemaField

Field Summary
static int NOT_SET_VALUE
          a static final value for properties are not set by the configuration file this value will be set to all long and int properties by default
 
Constructor Summary
IndexSchema()
          Creates a new IndexSchema and initialize the standard service analyzer to StandardAnalyzer
 
Method Summary
 void addSchemaField(IndexSchemaField field)
          Adds a new IndexSchemaField to the schema.
 boolean equals(Object object)
           
 int getCommitAfterDocuments()
          Defines after how many added,removed or updated document the indexer should commit.
 long getCommitLockTimeout()
           
 String getDefaultSearchField()
           
 Collection<IndexSchemaField> getFields()
           
 long getIndexerIdleTime()
           
 String getIndexLocation()
           
 int getMaxBufferedDocs()
           
 int getMaxFieldLength()
           
 int getMaxMergeDocs()
           
 int getMergeFactor()
           
 String getName()
           
 int getOptimizeAfterCommit()
          Defines after how many commits the indexer should optimize the index
 Analyzer getSchemaAnalyzer()
           
 Set<String> getSearchableFieldNames()
           
 Analyzer getServiceAnalyzer()
           
 long getWriteLockTimeout()
           
 int hashCode()
           
 void initialize()
          Initialize the schema and checks all required values
 boolean isUseCompoundFile()
           
 boolean isUseTimedIndexer()
           
 void setCommitAfterDocuments(int commitAfterDocuments)
           
 void setCommitLockTimeout(long commitLockTimeout)
           
 void setDefaultSearchField(String defaultField)
           
 void setIndexerIdleTime(long indexerIdleTime)
           
 void setIndexLocation(String indexLocation)
           
 void setMaxBufferedDocs(int maxBufferedDocs)
           
 void setMaxFieldLength(int maxFieldLength)
           
 void setMaxMergeDocs(int maxMergeDocs)
           
 void setMergeFactor(int mergeFactor)
           
 void setName(String name)
           
 void setOptimizeAfterCommit(int optimizeAfterCommit)
           
 void setSchemaFields(Collection<IndexSchemaField> fields)
           
 void setServiceAnalyzer(Analyzer serviceAnalyzer)
           
 void setUseCompoundFile(boolean useCompoundFile)
           
 void setUseTimedIndexer(boolean useTimedIndexer)
           
 void setWriteLockTimeout(long writeLockTimeout)
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

NOT_SET_VALUE

public static final int NOT_SET_VALUE
a static final value for properties are not set by the configuration file this value will be set to all long and int properties by default

See Also:
Constant Field Values
Constructor Detail

IndexSchema

public IndexSchema()
Creates a new IndexSchema and initialize the standard service analyzer to StandardAnalyzer

Method Detail

initialize

public void initialize()
Initialize the schema and checks all required values


isUseCompoundFile

public boolean isUseCompoundFile()
Returns:
Returns the useCompoundFile.

setUseCompoundFile

public void setUseCompoundFile(boolean useCompoundFile)
Parameters:
useCompoundFile - The useCompoundFile to set.

addSchemaField

public void addSchemaField(IndexSchemaField field)
Adds a new IndexSchemaField to the schema. if the fields name equals IndexDocument.FIELD_ENTRY_ID or the field is null it will simply ignored

Parameters:
field - - the index schema field to add as a field of this schema.

getFields

public Collection<IndexSchemaField> getFields()
Returns:
Returns the fieldConfiguration.

getSchemaAnalyzer

public Analyzer getSchemaAnalyzer()
Returns:
- the analyzer instance to be used for this schema

getServiceAnalyzer

public Analyzer getServiceAnalyzer()
Returns:
Returns the serviceAnalyzer.

setServiceAnalyzer

public void setServiceAnalyzer(Analyzer serviceAnalyzer)
Parameters:
serviceAnalyzer - The serviceAnalyzer to set.

getCommitLockTimeout

public long getCommitLockTimeout()
Returns:
Returns the commitLockTimout.

setCommitLockTimeout

public void setCommitLockTimeout(long commitLockTimeout)
Parameters:
commitLockTimeout - The commitLockTimeout to set.

getMaxBufferedDocs

public int getMaxBufferedDocs()
Returns:
Returns the maxBufferedDocs.

setMaxBufferedDocs

public void setMaxBufferedDocs(int maxBufferedDocs)
Parameters:
maxBufferedDocs - The maxBufferedDocs to set.

getMaxFieldLength

public int getMaxFieldLength()
Returns:
Returns the maxFieldLength.

setMaxFieldLength

public void setMaxFieldLength(int maxFieldLength)
Parameters:
maxFieldLength - The maxFieldLength to set.

getMaxMergeDocs

public int getMaxMergeDocs()
Returns:
Returns the maxMergeDocs.

setMaxMergeDocs

public void setMaxMergeDocs(int maxMergeDocs)
Parameters:
maxMergeDocs - The maxMergeDocs to set.

getMergeFactor

public int getMergeFactor()
Returns:
Returns the mergeFactor.

setMergeFactor

public void setMergeFactor(int mergeFactor)
Parameters:
mergeFactor - The mergeFactor to set.

getWriteLockTimeout

public long getWriteLockTimeout()
Returns:
Returns the writeLockTimeout.

setWriteLockTimeout

public void setWriteLockTimeout(long writeLockTimeout)
Parameters:
writeLockTimeout - The writeLockTimeout to set.

setSchemaFields

public void setSchemaFields(Collection<IndexSchemaField> fields)
Parameters:
fields - The fieldConfiguration to set.

getName

public String getName()
Returns:
Returns the name.

equals

public boolean equals(Object object)
Overrides:
equals in class Object
See Also:
Object.equals(java.lang.Object)

hashCode

public int hashCode()
Overrides:
hashCode in class Object
See Also:
Object.hashCode()

setName

public void setName(String name)
Parameters:
name - The name to set.

getIndexLocation

public String getIndexLocation()
Returns:
Returns the indexLocation.

setIndexLocation

public void setIndexLocation(String indexLocation)
Parameters:
indexLocation - The indexLocation to set.

getDefaultSearchField

public String getDefaultSearchField()
Returns:
Returns the defaultField.

setDefaultSearchField

public void setDefaultSearchField(String defaultField)
Parameters:
defaultField - The defaultField to set.

getIndexerIdleTime

public long getIndexerIdleTime()
Returns:
Returns the indexerIdleTime.

setIndexerIdleTime

public void setIndexerIdleTime(long indexerIdleTime)
Parameters:
indexerIdleTime - The indexerIdleTime to set.

isUseTimedIndexer

public boolean isUseTimedIndexer()
Returns:
Returns the useTimedIndexer.

setUseTimedIndexer

public void setUseTimedIndexer(boolean useTimedIndexer)
Parameters:
useTimedIndexer - The useTimedIndexer to set.

toString

public String toString()
Overrides:
toString in class Object
See Also:
Object.toString()

getSearchableFieldNames

public Set<String> getSearchableFieldNames()
Returns:
Returns the searchableFieldNames.

getCommitAfterDocuments

public int getCommitAfterDocuments()
Defines after how many added,removed or updated document the indexer should commit.

Returns:
Returns the commitAfterDocuments.

setCommitAfterDocuments

public void setCommitAfterDocuments(int commitAfterDocuments)
Parameters:
commitAfterDocuments - The commitAfterDocuments to set.

getOptimizeAfterCommit

public int getOptimizeAfterCommit()
Defines after how many commits the indexer should optimize the index

Returns:
Returns the optimizeAfterCommit.

setOptimizeAfterCommit

public void setOptimizeAfterCommit(int optimizeAfterCommit)
Parameters:
optimizeAfterCommit - The optimizeAfterCommit to set.


Copyright © 2000-2008 Apache Software Foundation. All Rights Reserved.