|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.mycore.common.events.MCREventHandlerBase
org.mycore.services.fieldquery.MCRSearcher
public abstract class MCRSearcher
Abstract base class for searchers and indexers. Searcher implementations for a specific backend must be implemented as a subclass. This class implements MCREventHandler. Indexers can easily be implemented by overwriting the two methods addToIndex and removeFromIndex. Searchers are implemented by overwriting the method search. Searchers that do not need indexing or do this on their own can simply ignore the add/remove methods.
| Field Summary | |
|---|---|
protected String |
ID
The unique searcher ID for this MCRSearcher implementation |
protected String |
index
The ID of the index this searcher handles * |
static Logger |
LOGGER
The logger |
protected String |
prefix
The prefix of all properties in mycore.properties for this searcher |
protected static MCRCache |
RETURN_ID_CACHE
|
| Constructor Summary | |
|---|---|
MCRSearcher()
|
|
| Method Summary | |
|---|---|
void |
addSortData(Iterator<MCRHit> hits,
List<MCRSortBy> sortBy)
Adds field values needed for sorting for those hits that do not have sort data set already. |
void |
addToIndex(String entryID,
String returnID,
List<MCRFieldValue> fields)
Adds field values to the search index. |
void |
clearIndex()
Removes all entries from index. |
void |
clearIndex(String fieldname,
String value)
Removes all entries of a field with a given value from index. |
String |
getID()
Returns the unique store ID that was set for this store instance |
String |
getIndex()
Returns the ID of the index this searcher is configured for. |
String |
getReturnID(MCRFile file)
|
protected void |
handleFileCreated(MCREvent evt,
MCRFile file)
Handles file created events. |
protected void |
handleFileDeleted(MCREvent evt,
MCRFile file)
Handles file deleted events. |
protected void |
handleFileRepaired(MCREvent evt,
MCRFile file)
Handles file repair events. |
protected void |
handleFileUpdated(MCREvent evt,
MCRFile file)
Handles file updated events. |
protected void |
handleObjectCreated(MCREvent evt,
MCRObject obj)
Handles object created events. |
protected void |
handleObjectDeleted(MCREvent evt,
MCRObject obj)
Handles object deleted events. |
protected void |
handleObjectRepaired(MCREvent evt,
MCRObject obj)
Handles object repair events. |
protected void |
handleObjectUpdated(MCREvent evt,
MCRObject obj)
Handles object updated events. |
void |
init(String ID)
Initializes the searcher and sets its unique ID. |
void |
notifySearcher(String mode)
Inform Searcher what is going on. |
void |
removeFromIndex(String entryID)
Removes the values of the given entry from the backend index. |
abstract MCRResults |
search(MCRCondition condition,
int maxResults,
List<MCRSortBy> sortBy,
boolean addSortData)
Executes a query on this searcher. |
protected void |
undoObjectCreated(MCREvent evt,
MCRObject obj)
Handles undo of object created events. |
protected void |
undoObjectDeleted(MCREvent evt,
MCRObject obj)
Handles undo of object deleted events. |
| 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 |
|---|
public static Logger LOGGER
protected String ID
protected String prefix
protected String index
protected static MCRCache RETURN_ID_CACHE
| Constructor Detail |
|---|
public MCRSearcher()
| Method Detail |
|---|
public void init(String ID)
ID - the non-null unique ID of this searcher instancepublic String getID()
public String getIndex()
public String getReturnID(MCRFile file)
protected void handleFileCreated(MCREvent evt,
MCRFile file)
MCREventHandlerBase
handleFileCreated in class MCREventHandlerBaseevt - the event that occuredfile - the MCRFile that caused the event
protected void handleFileUpdated(MCREvent evt,
MCRFile file)
MCREventHandlerBase
handleFileUpdated in class MCREventHandlerBaseevt - the event that occuredfile - the MCRFile that caused the event
protected void handleFileDeleted(MCREvent evt,
MCRFile file)
MCREventHandlerBase
handleFileDeleted in class MCREventHandlerBaseevt - the event that occuredfile - the MCRFile that caused the event
protected void handleFileRepaired(MCREvent evt,
MCRFile file)
MCREventHandlerBase
handleFileRepaired in class MCREventHandlerBaseevt - the event that occuredfile - the MCRFile that caused the event
protected void handleObjectCreated(MCREvent evt,
MCRObject obj)
MCREventHandlerBase
handleObjectCreated in class MCREventHandlerBaseevt - the event that occuredobj - the MCRObject that caused the event
protected void handleObjectUpdated(MCREvent evt,
MCRObject obj)
MCREventHandlerBase
handleObjectUpdated in class MCREventHandlerBaseevt - the event that occuredobj - the MCRObject that caused the event
protected void handleObjectDeleted(MCREvent evt,
MCRObject obj)
MCREventHandlerBase
handleObjectDeleted in class MCREventHandlerBaseevt - the event that occuredobj - the MCRObject that caused the event
protected void handleObjectRepaired(MCREvent evt,
MCRObject obj)
MCREventHandlerBase
handleObjectRepaired in class MCREventHandlerBaseevt - the event that occuredobj - the MCRObject that caused the event
protected void undoObjectCreated(MCREvent evt,
MCRObject obj)
MCREventHandlerBase
undoObjectCreated in class MCREventHandlerBaseevt - the event that occuredobj - the MCRObject that caused the event
protected void undoObjectDeleted(MCREvent evt,
MCRObject obj)
MCREventHandlerBase
undoObjectDeleted in class MCREventHandlerBaseevt - the event that occuredobj - the MCRObject that caused the event
public void addToIndex(String entryID,
String returnID,
List<MCRFieldValue> fields)
entryID - the unique ID of this entry in the indexreturnID - the ID to return as result of a search (MCRHit ID)fields - a List of MCRFieldValue objectspublic void removeFromIndex(String entryID)
entryID - the unique ID of this entry in the index
public abstract MCRResults search(MCRCondition condition,
int maxResults,
List<MCRSortBy> sortBy,
boolean addSortData)
cond - the query conditionmaxResults - the maximum number of results to return, 0 means all resultssortBy - a not-null list of MCRSortBy sort criteria. The list is empty if the results should not be sortedaddSortData - 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
public void addSortData(Iterator<MCRHit> hits,
List<MCRSortBy> sortBy)
hits - the MCRHit objects that do not have sort data setsortBy - the MCRFieldDef fields that are sort criteriapublic void clearIndex()
public void clearIndex(String fieldname,
String value)
public void notifySearcher(String mode)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||