public interface SearchIndexer extends Flushable, Closeable
SearchEngine
.SearchIndexerBuilder
Modifier and Type | Method and Description |
---|---|
void |
add(MutableSearchEntry entry)
This method adds the given
entry to the search-index. |
void |
close()
This method closes the search index.
|
MutableSearchEntry |
createEntry()
This method creates a new and empty entry for the search-index.
|
void |
flush()
This method flushes the search index what ensures that all changes are
written to the index.
|
SearchEngine |
getSearchEngine()
This method gets the
SearchEngine for the index of this
SearchIndexer . |
void |
optimize()
This method optimizes the search index.
|
boolean |
remove(SearchHit hit)
This method removes an
existing entry
identified by the given hit . |
int |
remove(String field,
Object value)
This method removes all
existing entries
identified by the given value at the given
property from the search-index. |
int |
removeByCustumId(String cid)
This method removes an
existing entry
identified by the given uri from the search-index. |
boolean |
removeById(Long entryId)
|
int |
removeByUri(String uri,
String sourceId)
This method removes an
existing entry
identified by the given uri from the search-index. |
int |
update(MutableSearchEntry entry)
This method updates the given
entry in the search-index. |
MutableSearchEntry createEntry()
filled
with
data, use add(MutableSearchEntry)
to add it to the search index.void add(MutableSearchEntry entry) throws SearchException
entry
to the search-index.entry
- is the entry to add.SearchException
- if the operation failed.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).entry
- 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.boolean removeById(Long entryId) throws SearchException
existing
entry
identified by the given
id
from
the search-index. entryId
- 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.boolean remove(SearchHit hit) throws SearchException
existing
entry
identified by the given hit
. In most cases this method will
delegate to removeById(Long)
. However the implementation can
decide what is the best way to do it.hit
- 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.int removeByCustumId(String cid) throws SearchException
existing
entry
identified by the given uri
from the search-index.cid
- 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.update(MutableSearchEntry)
int removeByUri(String uri, String sourceId) throws SearchException
existing
entry
identified by the given uri
from the search-index.uri
- 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.update(MutableSearchEntry)
int remove(String field, Object value) throws SearchException
existing
entries
identified by the given value
at the given
property
from the search-index. field
- is the name of the
field
where the value
is expected to occur. Therefore
the field should NOT to be of the
type
SearchFieldType.TEXT
.value
- is the
value
of the field.-1
if
the number is unknown because this is not supported by the
implementation.SearchException
- if the operation failed.void flush() throws SearchException
flush
in interface Flushable
SearchException
- if the operation failed.void optimize() throws SearchException
searches
.SearchException
- if the operation failed.SearchEngine getSearchEngine()
SearchEngine
for the index of this
SearchIndexer
. It may be used for advanced indexing where
search-queries need to performed for updating the search-index.SearchEngine
.void close() throws SearchException
close
in interface AutoCloseable
close
in interface Closeable
SearchException
- if the operation failed.Copyright © 2001–2016 mmm-Team. All rights reserved.