public abstract class AbstractSearchIndexer extends AbstractLoggableObject implements SearchIndexer
SearchIndexer
interface.| Constructor and Description |
|---|
AbstractSearchIndexer()
The constructor.
|
| Modifier and Type | Method and Description |
|---|---|
protected abstract void |
add(MutableSearchEntry entry,
Long id) |
boolean |
remove(SearchHit hit)
This method removes an
existing entry
identified by the given hit. |
protected int |
remove(SearchResultPage page)
This method removes all
hits of
the given SearchResultPage. |
int |
removeByCustumId(String uid)
This method removes an
existing entry
identified by the given uri from the search-index. |
boolean |
removeById(Long id)
|
int |
removeByUri(String uri,
String sourceId)
This method removes an
existing entry
identified by the given uri from the search-index. |
protected SearchResultPage |
search(Long id,
Object cid,
String uri,
String source)
This method searches the
entries with the
specified properties. |
int |
update(MutableSearchEntry entry)
This method updates the given
entry in the search-index. |
getLoggerclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitadd, close, createEntry, flush, getSearchEngine, optimize, removeprotected abstract void add(MutableSearchEntry entry, Long id)
entry - is the MutableSearchEntry to add.id - is the ID for the
entry.SearchIndexer.add(MutableSearchEntry)public int update(MutableSearchEntry entry) throws SearchException
entry in the search-index. This
method will use the property
SearchEntry.FIELD_CUSTOM_ID to identify a
potentially existing entry to update. Otherwise it will use a
combination of SearchEntry.FIELD_URI and
SearchEntry.FIELD_SOURCE as identifier (what
is NOT a very strong ID as the URI can change).update in interface SearchIndexerentry - is the entry to update.1 if one entry was replaced or
0 none was replaced and the given entry
has only been added. A value
greater than 1 indicates that multiple entries have
been replaced that all have the same identifier what indicates a
mistake of your index or the indexer.SearchException - if the operation failed.public boolean remove(SearchHit hit) throws SearchException
existing entry
identified by the given hit. In most cases this method will
delegate to SearchIndexer.removeById(Long). However the implementation can
decide what is the best way to do it.remove in interface SearchIndexerhit - is the SearchHit to remove.true if the entry existed and has been removed from
the index, false if NO entry exists for the given
hit.SearchException - if the operation failed.public int removeByCustumId(String uid) throws SearchException
existing entry
identified by the given uri from the search-index.removeByCustumId in interface SearchIndexeruid - is the custom-ID of an
entry previously added to the
index.1 if one entry exists with the given
uid or 0 if no such entry exists. A value
greater than 1 indicates that multiple entries have
been removed that all have the given uid what
indicates a mistake of your index(er). A value of -1
means the number is unknown because this is not supported by the
implementation.SearchException - if the operation failed.SearchIndexer.update(MutableSearchEntry)public boolean removeById(Long id) throws SearchException
existing entry
identified by the given
id from
the search-index. removeById in interface SearchIndexerid - is the
ID of the
entry to remove (NOT null).true if the entry existed and has been removed from
the index, false if NO entry exists for the given
id.SearchException - if the operation failed.public int removeByUri(String uri, String sourceId) throws SearchException
existing entry
identified by the given uri from the search-index.removeByUri in interface SearchIndexeruri - is the URI of an entry
previously added to the index.sourceId - is the
ID of the
SearchSource. This is required
because the uri itself may NOT be unique (e.g.
different sources might both contain the entry with URI
"index.html").1 if one entry exists with the given
uri or 0 if no such entry exists. A value
greater than 1 indicates that multiple entries have
been removed that all have the given uri. A value of
-1 means the number is unknown because this is not
supported by the implementation.SearchException - if the operation failed.SearchIndexer.update(MutableSearchEntry)protected int remove(SearchResultPage page)
hits of
the given SearchResultPage.page - is the SearchResultPage to delete.SearchResultPage.getPageCount().protected SearchResultPage search(Long id, Object cid, String uri, String source)
entries with the
specified properties. At least one of the properties has to be set (not
null).id - is the ID or null
if any ID should match.cid - is the custom-ID or
null if any custom-ID should match.uri - is the URI or
null if any URI should match.source - is the source or
null if any source should match.SearchResultPage for the specified query.Copyright © 2001–2016 mmm-Team. All rights reserved.