org.mycore.backend.lucene
Class MCRLuceneTools

java.lang.Object
  extended by org.mycore.backend.lucene.MCRLuceneTools

public class MCRLuceneTools
extends Object

Use Lucene Analyzer to normalize strings

Version:
$Revision: 13085 $ $Date: 2008-02-06 18:27:24 +0100 (Mi, 06 Feb 2008) $
Author:
Harald Richter

Field Summary
(package private)  MCRConfiguration config
           
 
Constructor Summary
MCRLuceneTools()
           
 
Method Summary
static void deleteLuceneDocument(String fieldname, String id, String indexDir)
          Delete all documents in Lucene with id
static org.apache.lucene.index.IndexWriter getLuceneWriter(String indexDir, boolean first)
          Get Lucene Writer
static String luceneNormalize(String value, String ID)
          Use Lucene Analyzer to normalize strings
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

config

MCRConfiguration config
Constructor Detail

MCRLuceneTools

public MCRLuceneTools()
Method Detail

luceneNormalize

public static String luceneNormalize(String value,
                                     String ID)
                              throws Exception
Use Lucene Analyzer to normalize strings

Parameters:
value - string to convert
ID - The classes that do the normalization come from the lucene package and are configured by the property MCR.Lucene.Analyzer..Class in mycore.properties.
Returns:
the normalized string
Throws:
Exception

getLuceneWriter

public static org.apache.lucene.index.IndexWriter getLuceneWriter(String indexDir,
                                                                  boolean first)
                                                           throws Exception
Get Lucene Writer

Parameters:
indexDir - directory where lucene index is store first check existance of index directory, if it does nor exist create it
Returns:
the lucene writer, calling programm must close writer
Throws:
Exception

deleteLuceneDocument

public static void deleteLuceneDocument(String fieldname,
                                        String id,
                                        String indexDir)
                                 throws Exception
Delete all documents in Lucene with id

Parameters:
fieldname - string name of lucene field with stored id
id - string document id
indexDir - * the directory where index is stored
Throws:
Exception