public interface SearchEngine
Modifier and Type | Method and Description |
---|---|
long |
count(String field,
String value)
|
SearchEntry |
getEntry(String entryId)
|
SearchQueryBuilder |
getQueryBuilder()
This method gets the query builder user to create and parse queries.
|
long |
getTotalEntryCount()
This method gets the total number of
SearchEntry s in the search-index. |
SearchResultPage |
search(SearchQuery query,
int hitsPerPage)
This method performs an initial search for a given
query and returns the first
SearchResultPage . |
SearchResultPage |
search(SearchQuery query,
int hitsPerPage,
int pageIndex,
int totalHitCount)
This method performs a search for a subsequent
SearchResultPage of an
initial search . |
SearchQueryBuilder getQueryBuilder()
SearchResultPage search(SearchQuery query, int hitsPerPage) throws SearchException
query
and returns the first
SearchResultPage
. The hits
are in descending order of their
score
so the best hit
is the first
hit
of the page . SearchResultPage
use
search(SearchQuery, int, int, int)
.query
- is the query
of the user that wants to search. Use the
query-builder
to construct.hitsPerPage
- is the number of hits per page
. See
SearchResultPage.DEFAULT_HITS_PER_PAGE
.query
at the given pageIndex
.SearchException
- if the search can NOT be performed for technical reasons.getQueryBuilder()
SearchResultPage search(SearchQuery query, int hitsPerPage, int pageIndex, int totalHitCount) throws SearchException
SearchResultPage
of an
initial search
. The hits
are in descending order of
their score
.query
- is the query
of the user that wants to search. Use the
query-builder
to construct.hitsPerPage
- is the number of hits
contained in a SearchResultPage
. This
should be the same value as in the initial search
.pageIndex
- is the page index
of the requested
search result
. For a new query this should initially be 0
.
After a search result
was retrieved by this method, further calls for the
same
query
can be performed with
a pageIndex
greater than 0
and less than
SearchResultPage.getPageCount()
. pageIndex
is always valid in the sense as described
above (the search index may have been modified in the meantime). An implementation has to be able
to handle calls with a pageIndex
greater or equal to
SearchResultPage.getPageCount()
. The recommended strategy is to return the
last page in this case.totalHitCount
- is the total hit count
expected for this
query that is already known from the initial search
. The
implementation has to be able to handle that the search index may have been modified in the
meantime and the value is NOT correct anymore. If the implementation can determine the correct
total hit-count without performance overhead, it may ignore this parameter.query
at the given pageIndex
.SearchException
- if the search can NOT be performed for technical reasons.long count(String field, String value)
SearchEntry
s where the given field
has the given
value
. This can be useful for counting the SearchEntry
s of a particular
source
or type
. You could also do a search
to figure this out but this method is supposed to be much faster.field
- is the name of the field
.value
- is the potential value
to match.SearchEntry
s.long getTotalEntryCount()
SearchEntry
s in the search-index.SearchEntry
s.SearchEntry getEntry(String entryId) throws SearchException
entry
by its technical entry-ID
. hit
in a new request (without
rerunning the search).entryId
- is the ID
of the requested entry.id
or null
if no such entry is available.SearchException
- if the operation failed for technical reasons.Copyright © 2001–2016 mmm-Team. All rights reserved.