|
||||||||||
| 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
org.mycore.backend.jdom.MCRJDOMSearcher
public class MCRJDOMSearcher
Implements a searcher and indexer for MCRObject metadata using only data in memory without any persistent structures. When data is indexed, the values are stored as XML document in memory. When data is searched, the query is transformed to a XSL condition and run against the XML in memory. Before first use of instances of this class, all MCRObject metadata is loaded from persistent store and indexed in memory. This class may also be useful for learning how to implement MCRSearchers and indexers.
| Field Summary |
|---|
| Fields inherited from class org.mycore.services.fieldquery.MCRSearcher |
|---|
ID, index, prefix, RETURN_ID_CACHE |
| Constructor Summary | |
|---|---|
MCRJDOMSearcher()
|
|
| 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 fields)
Adds field values to the search index. |
static boolean |
compare(String valueA,
String valueB,
String operator)
Implements a string compare operator as Xalan function extension |
static boolean |
contains(String value,
String words)
Implements the contains operator as Xalan function extension |
void |
init(String ID)
Initializes the searcher and sets its unique ID. |
static boolean |
like(String value,
String pattern)
Implements the like operator as Xalan function extension |
void |
removeFromIndex(String entryID)
Removes the values of the given entry from the backend index. |
MCRResults |
search(MCRCondition condition,
int maxResults,
List sortBy,
boolean addSortData)
Executes a query on this searcher. |
| Methods inherited from class org.mycore.services.fieldquery.MCRSearcher |
|---|
clearIndex, clearIndex, getID, getIndex, getReturnID, handleFileCreated, handleFileDeleted, handleFileRepaired, handleFileUpdated, handleObjectCreated, handleObjectDeleted, handleObjectRepaired, handleObjectUpdated, notifySearcher, undoObjectCreated, undoObjectDeleted |
| 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 |
| Constructor Detail |
|---|
public MCRJDOMSearcher()
| Method Detail |
|---|
public void init(String ID)
MCRSearcher
init in class MCRSearcherID - the non-null unique ID of this searcher instance
public void addToIndex(String entryID,
String returnID,
List fields)
MCRSearcher
addToIndex in class MCRSearcherentryID - 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)
MCRSearcher
removeFromIndex in class MCRSearcherentryID - the unique ID of this entry in the index
public MCRResults search(MCRCondition condition,
int maxResults,
List sortBy,
boolean addSortData)
MCRSearcher
search in class MCRSearchermaxResults - 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 static boolean contains(String value,
String words)
public static boolean like(String value,
String pattern)
public static boolean compare(String valueA,
String valueB,
String operator)
public void addSortData(Iterator<MCRHit> hits,
List<MCRSortBy> sortBy)
MCRSearcher
addSortData in class MCRSearcherhits - the MCRHit objects that do not have sort data setsortBy - the MCRFieldDef fields that are sort criteria
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||