org.mycore.backend.lucene
Class MCROldLuceneSearcher

java.lang.Object
  extended by org.mycore.common.events.MCREventHandlerBase
      extended by org.mycore.services.fieldquery.MCRSearcher
          extended by org.mycore.backend.lucene.MCROldLuceneSearcher
All Implemented Interfaces:
MCREventHandler

Deprecated. use MCRLuceneSearcher

public class MCROldLuceneSearcher
extends MCRSearcher

This class builds indexes from mycore meta data. Based on MCRLucenesearcher Version 1.43 for miless-software

Author:
Harald Richter

Field Summary
(package private) static org.apache.lucene.analysis.Analyzer analyzer
          Deprecated.  
(package private) static int DEC_AFTER
          Deprecated.  
(package private) static int DEC_BEFORE
          Deprecated.  
(package private)  boolean FIRST
          Deprecated.  
(package private)  String IndexDir
          Deprecated.  
(package private) static int INT_BEFORE
          Deprecated.  
(package private) static String LOCK_DIR
          Deprecated.  
 
Fields inherited from class org.mycore.services.fieldquery.MCRSearcher
ID, index, prefix, RETURN_ID_CACHE
 
Constructor Summary
MCROldLuceneSearcher()
          Deprecated.  
 
Method Summary
 void addSortData(Iterator<MCRHit> hits, List<MCRSortBy> sortBy)
          Deprecated. Adds field values needed for sorting for those hits that do not have sort data set already.
 void addToIndex(String entryID, String returnID, List fields)
          Deprecated. Adds field values to the search index.
static org.apache.lucene.document.Document buildLuceneDocument(List fields)
          Deprecated. Build lucene document from transformed xml list
 void clearIndex()
          Deprecated. Removes all entries from index.
static void deleteLuceneDocument(String fieldname, String id, String indexDir)
          Deprecated. Delete all documents in Lucene with id
static org.apache.lucene.index.IndexWriter getLuceneWriter(String indexDir, boolean first)
          Deprecated. Get Lucene Writer
 void init(String ID)
          Deprecated. Initializes the searcher and sets its unique ID.
 void removeFromIndex(String entryID)
          Deprecated. Removes the values of the given entry from the backend index.
 MCRResults search(MCRCondition condition, int maxResults, List<MCRSortBy> sortBy, boolean addSortData)
          Deprecated. Executes a query on this searcher.
 
Methods inherited from class org.mycore.services.fieldquery.MCRSearcher
clearIndex, getID, getIndex, getReturnID, handleFileCreated, handleFileDeleted, handleFileRepaired, handleFileUpdated, handleObjectCreated, handleObjectDeleted, handleObjectRepaired, handleObjectUpdated, notifySearcher, undoObjectCreated, undoObjectDeleted
 
Methods inherited from class org.mycore.common.events.MCREventHandlerBase
doHandleEvent, doNothing, handleClassificationCreated, handleClassificationDeleted, handleClassificationRepaired, handleClassificationUpdated, handleDerivateCreated, handleDerivateDeleted, handleDerivateRepaired, handleDerivateUpdated, undoClassificationCreated, undoClassificationDeleted, undoClassificationRepaired, undoClassificationUpdated, undoDerivateCreated, undoDerivateDeleted, undoDerivateRepaired, undoDerivateUpdated, undoFileCreated, undoFileDeleted, undoFileRepaired, undoFileUpdated, undoHandleEvent, undoObjectRepaired, undoObjectUpdated
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.mycore.common.events.MCREventHandler
doHandleEvent, undoHandleEvent
 

Field Detail

IndexDir

String IndexDir
Deprecated. 

FIRST

boolean FIRST
Deprecated. 

LOCK_DIR

static String LOCK_DIR
Deprecated. 

INT_BEFORE

static int INT_BEFORE
Deprecated. 

DEC_BEFORE

static int DEC_BEFORE
Deprecated. 

DEC_AFTER

static int DEC_AFTER
Deprecated. 

analyzer

static org.apache.lucene.analysis.Analyzer analyzer
Deprecated. 
Constructor Detail

MCROldLuceneSearcher

public MCROldLuceneSearcher()
Deprecated. 
Method Detail

init

public void init(String ID)
Deprecated. 
Description copied from class: MCRSearcher
Initializes the searcher and sets its unique ID.

Overrides:
init in class MCRSearcher
Parameters:
ID - the non-null unique ID of this searcher instance

addToIndex

public void addToIndex(String entryID,
                       String returnID,
                       List fields)
Deprecated. 
Description copied from class: MCRSearcher
Adds field values to the search index. Searchers that need an indexer must overwrite this method to store the values in their backend index. If this class is configured as event handler, this method is automatically called when objects are created or updated. The field values have been extracted from the object's data as defined by searchfields.xml

Overrides:
addToIndex in class MCRSearcher
Parameters:
entryID - the unique ID of this entry in the index
returnID - the ID to return as result of a search (MCRHit ID)
fields - a List of MCRFieldValue objects

buildLuceneDocument

public static org.apache.lucene.document.Document buildLuceneDocument(List fields)
                                                               throws Exception
Deprecated. 
Build lucene document from transformed xml list

Parameters:
fields - corresponding to lucene fields
Returns:
The lucene document
Throws:
Exception

getLuceneWriter

public static org.apache.lucene.index.IndexWriter getLuceneWriter(String indexDir,
                                                                  boolean first)
                                                           throws Exception
Deprecated. 
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

removeFromIndex

public void removeFromIndex(String entryID)
Deprecated. 
Description copied from class: MCRSearcher
Removes the values of the given entry from the backend index. Searchers that need an indexer must overwrite this method to delete the values in their backend index. If this class is configured as event handler, this method is automatically called when objects are deleted or updated.

Overrides:
removeFromIndex in class MCRSearcher
Parameters:
entryID - the unique ID of this entry in the index

deleteLuceneDocument

public static void deleteLuceneDocument(String fieldname,
                                        String id,
                                        String indexDir)
                                 throws Exception
Deprecated. 
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

search

public MCRResults search(MCRCondition condition,
                         int maxResults,
                         List<MCRSortBy> sortBy,
                         boolean addSortData)
Deprecated. 
Description copied from class: MCRSearcher
Executes a query on this searcher. The query MUST only refer to fields that are managed by this searcher.

Specified by:
search in class MCRSearcher
maxResults - the maximum number of results to return, 0 means all results
sortBy - a not-null list of MCRSortBy sort criteria. The list is empty if the results should not be sorted
addSortData - if false, backend should sort results itself while executing the query. If this is not possible or the parameter is true, backend should not sort the results itself, but only store the data of the fields in the sortBy list which are needed to sort later
Returns:
the query results

addSortData

public void addSortData(Iterator<MCRHit> hits,
                        List<MCRSortBy> sortBy)
Deprecated. 
Description copied from class: MCRSearcher
Adds field values needed for sorting for those hits that do not have sort data set already. Subclasses must overwrite this method, otherwise sorting results will not always work correctly. The default implementation in this class does nothing.

Overrides:
addSortData in class MCRSearcher
Parameters:
hits - the MCRHit objects that do not have sort data set
sortBy - the MCRFieldDef fields that are sort criteria

clearIndex

public void clearIndex()
Deprecated. 
Description copied from class: MCRSearcher
Removes all entries from index.

Overrides:
clearIndex in class MCRSearcher