org.apache.cocoon.components.search
Class Index

java.lang.Object
  extended by org.apache.cocoon.components.search.Index

public class Index
extends java.lang.Object

Index Class

Author:
Nicolas Maisonneuve

Constructor Summary
Index()
           
 
Method Summary
 org.apache.lucene.document.Document createDocument(java.lang.String uid)
          Create a lucene document
 org.apache.lucene.document.Field createField(java.lang.String fieldname, java.util.Date value)
          create a lucene field for date value
 org.apache.lucene.document.Field createField(java.lang.String fieldname, java.lang.String value)
          create a lucene field
 java.lang.String getDefaultAnalyzerID()
          get the default Analyzer
 org.apache.lucene.store.Directory getDirectory()
          get the lucene directory
 java.lang.String getID()
          get the index ID
 Indexer getIndexer()
          get the indexer of the index
 IndexStructure getStructure()
          Return the index Structure
 void releaseIndexer(Indexer indexer)
          Release the indexer
 void setDefaultAnalyzerID(java.lang.String defaultAnalyzerID)
          set the default Analyzer
 boolean setDirectory(org.apache.lucene.store.Directory dir)
          Set the lucene Directory
 boolean setDirectory(java.lang.String path)
          Set the index path directory
 void setID(java.lang.String id)
          Set the index ID
 void setIndexer(java.lang.String indexer)
           
 void setManager(org.apache.avalon.framework.service.ServiceManager manager)
           
 void setStructure(IndexStructure structure)
          Set the index structure
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Index

public Index()
Method Detail

createDocument

public org.apache.lucene.document.Document createDocument(java.lang.String uid)
Create a lucene document

Parameters:
uid - String the document uid
Returns:
Document a empty document

createField

public org.apache.lucene.document.Field createField(java.lang.String fieldname,
                                                    java.lang.String value)
                                             throws IndexException
create a lucene field

Parameters:
fieldname - String fieldname (must existed in the index structure)
value - String value
Throws:
IndexException

createField

public org.apache.lucene.document.Field createField(java.lang.String fieldname,
                                                    java.util.Date value)
                                             throws IndexException
create a lucene field for date value

Parameters:
fieldname - String fieldname (must existed in the index structure)
value - String value
Throws:
IndexException

getIndexer

public Indexer getIndexer()
                   throws IndexException
get the indexer of the index

Returns:
Indexer
Throws:
IndexException

releaseIndexer

public void releaseIndexer(Indexer indexer)
Release the indexer

Parameters:
indexer -

getID

public java.lang.String getID()
get the index ID

Returns:
the index ID

setID

public void setID(java.lang.String id)
Set the index ID

Parameters:
id - index ID

getDefaultAnalyzerID

public java.lang.String getDefaultAnalyzerID()
get the default Analyzer

Returns:
the id of the default analyzer

setDefaultAnalyzerID

public void setDefaultAnalyzerID(java.lang.String defaultAnalyzerID)
set the default Analyzer

Parameters:
defaultAnalyzerID - the id of the default Analyzer

getStructure

public IndexStructure getStructure()
Return the index Structure

Returns:
the index Structure

setStructure

public void setStructure(IndexStructure structure)
Set the index structure

Parameters:
structure - IndexStructure

setManager

public void setManager(org.apache.avalon.framework.service.ServiceManager manager)

getDirectory

public org.apache.lucene.store.Directory getDirectory()
get the lucene directory

Returns:
the lucene directory

setDirectory

public boolean setDirectory(org.apache.lucene.store.Directory dir)
                     throws java.io.IOException
Set the lucene Directory

Parameters:
dir - lucene Directory
Returns:
success or not
Throws:
java.io.IOException

setDirectory

public boolean setDirectory(java.lang.String path)
                     throws java.io.IOException
Set the index path directory

Parameters:
path - String
Throws:
java.io.IOException

setIndexer

public void setIndexer(java.lang.String indexer)
Parameters:
indexer - The indexer to set.


Copyright $ Apache Software Foundation. All Rights Reserved.