|
||||||||||
| 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.lucene.MCRLuceneSearcher
public class MCRLuceneSearcher
This class builds indexes from mycore meta data.
| Field Summary | |
|---|---|
(package private) static org.apache.lucene.analysis.Analyzer |
analyzer
|
(package private) static int |
DEC_AFTER
|
(package private) static int |
DEC_BEFORE
|
(package private) File |
IndexDir
|
(package private) static int |
INT_BEFORE
|
| Fields inherited from class org.mycore.services.fieldquery.MCRSearcher |
|---|
ID, index, prefix, RETURN_ID_CACHE |
| Constructor Summary | |
|---|---|
MCRLuceneSearcher()
|
|
| 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. |
static org.apache.lucene.document.Document |
buildLuceneDocument(List<MCRFieldValue> fields)
Build lucene document from transformed xml list |
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. |
void |
close()
cleanly closes this object that implements Closeable. |
void |
deleteLuceneDocument(String fieldname,
String id)
Delete all documents in Lucene with id |
static String |
handleNumber(String content,
String type,
long add)
|
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. |
MCRResults |
search(MCRCondition condition,
int maxResults,
List<MCRSortBy> sortBy,
boolean addSortData)
As opposed to MCRSearcher the returned MCRResult is read only. |
String |
toString()
|
| Methods inherited from class org.mycore.services.fieldquery.MCRSearcher |
|---|
getID, getIndex, getReturnID, handleFileCreated, handleFileDeleted, handleFileRepaired, handleFileUpdated, handleObjectCreated, handleObjectDeleted, handleObjectRepaired, handleObjectUpdated, undoObjectCreated, undoObjectDeleted |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface org.mycore.common.events.MCREventHandler |
|---|
doHandleEvent, undoHandleEvent |
| Field Detail |
|---|
static int INT_BEFORE
static int DEC_BEFORE
static int DEC_AFTER
static org.apache.lucene.analysis.Analyzer analyzer
File IndexDir
| Constructor Detail |
|---|
public MCRLuceneSearcher()
| Method Detail |
|---|
public void init(String ID)
MCRSearcher
init in class MCRSearcherID - the non-null unique ID of this searcher instance
public static String handleNumber(String content,
String type,
long add)
public void removeFromIndex(String entryID)
MCRSearcher
removeFromIndex in class MCRSearcherentryID - the unique ID of this entry in the index
public void deleteLuceneDocument(String fieldname,
String id)
throws Exception
fieldname - string name of lucene field with stored idid - string document idindexDir - *
the directory where index is stored
Exception
public MCRResults search(MCRCondition condition,
int maxResults,
List<MCRSortBy> sortBy,
boolean addSortData)
MCRSearcher the returned MCRResult is read only.
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
MCRSearcher.search(MCRCondition, int, List, boolean)
public void addToIndex(String entryID,
String returnID,
List<MCRFieldValue> 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 objects
public static org.apache.lucene.document.Document buildLuceneDocument(List<MCRFieldValue> fields)
throws Exception
fields - corresponding to lucene fields
Exception
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 criteriapublic void clearIndex()
MCRSearcher
clearIndex in class MCRSearcher
public void clearIndex(String fieldname,
String value)
MCRSearcher
clearIndex in class MCRSearcherpublic void notifySearcher(String mode)
MCRSearcher
notifySearcher in class MCRSearcherpublic void close()
MCRShutdownHandler.CloseableCloseable.
You can provide some functionality to close open files and sockets or
so.
close in interface MCRShutdownHandler.Closeablepublic String toString()
toString in class Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||