@ProviderType
public interface SuggestionIndex
To persist single changes made to the index (add()
, remove()
), call save()
. The possibly
large-scale operations index()
and
delete()
will save automatically.
Note: make sure to close()
the index after usage to properly
release affected resources, e.g. an underlying JCR session. This should be
done in a try/finally block.
Modifier and Type | Method and Description |
---|---|
void |
add(java.lang.String term,
java.lang.String[] suggestions)
Adds suggestions for a given term to the index.
|
void |
close()
Closes the index and releases all allocated resources with it, e.g.
|
void |
delete()
Deletes the entire index.
|
void |
index(java.util.List<Term> terms,
int maxSuggestions,
boolean minimize)
Extracts a suggestion index based on the given terms, weighted by their
frequencies.
|
java.lang.String[] |
read(java.lang.String term)
Looks up the suggestions for a given term.
|
void |
remove(java.lang.String term)
Removes the term and its suggestions from the index.
|
void |
save()
Saves any single changes made to the index.
|
java.lang.String[] read(java.lang.String term) throws RepositoryException
term
- partial word to look up in the index; one or more charactersRepositoryException
- if an unexpected repository error occurredvoid add(java.lang.String term, java.lang.String[] suggestions) throws RepositoryException
To persist the change, save()
must be called.
term
- partial word for which the suggestions applysuggestions
- an array of suggestionsRepositoryException
- if an unexpected repository error occurredvoid remove(java.lang.String term) throws RepositoryException
To persist the change, save()
must be called.
term
- partial word to remove from the indexRepositoryException
- if an unexpected repository error occurredvoid delete() throws RepositoryException
Changes will be persisted automatically.
RepositoryException
- if an unexpected repository error occurredvoid save() throws RepositoryException
RepositoryException
- if an unexpected repository error occurredvoid close() throws RepositoryException
RepositoryException
- if an unexpected repository error occurredvoid index(java.util.List<Term> terms, int maxSuggestions, boolean minimize) throws RepositoryException
Changes will be persisted automatically.
terms
- a list of Term
s, with the string term and the
frequencymaxSuggestions
- the maximum number of suggestion per termminimize
- Whether the index should be minimized. That means (longer)
term prefixes that result in only one suggestion should not be
indexed; only the first prefix that will result in this single
suggestion would be stored, but not for the remaining letters
of the suggested word.RepositoryException
- if an unexpected repository error occurredCopyright © 2010 - 2020 Adobe. All Rights Reserved