Interface SearchEngine
-
- All Superinterfaces:
Application.Component,Application.Module
- All Known Implementing Classes:
ElasticSearchEngine,InstrumentedSearchEngineWrapper,SolrSearchEngine
public interface SearchEngine extends Application.Module
The principle interface for the SearchEngine. All search-related objects are created by these methods. All methods that throw SearchEngineException should attempt to distinguish whether the exception is caused because the SearchEngine is not responding. In that case, they should throw a SearchEngineNotRespondingException, so the client code can choose to respond accordingly.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface edu.cornell.mannlib.vitro.webapp.modules.Application.Component
Application.Component.LifecycleState
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidadd(SearchInputDocument... docs)Add documents to the search index.voidadd(Collection<SearchInputDocument> docs)Add documents to the search index.voidcommit()Explicitly commit all pending changes, and wait until they are visible to the search.voidcommit(boolean wait)Explicitly commit all pending changes, and optionally wait until they are visible to the search.SearchInputDocumentcreateInputDocument()Create a SearchInputDocument that can be populated and added to the index.SearchQuerycreateQuery()Create a SearchQuery that can be populated and used for searching.SearchQuerycreateQuery(String queryText)Convenience method to create a SearchQuery and set the query text in one step.voiddeleteById(String... ids)Delete documents from the search index, by unique ID.voiddeleteById(Collection<String> ids)Delete documents from the search index, by unique ID.voiddeleteByQuery(String query)Delete documents from the search index if they satisfy the query.intdocumentCount()Find the number of documents in the search index.voidping()Check to see whether the SearchEngine is alive.SearchResponsequery(SearchQuery query)Query the search index and return the results.-
Methods inherited from interface edu.cornell.mannlib.vitro.webapp.modules.Application.Component
shutdown, startup
-
-
-
-
Method Detail
-
ping
void ping() throws SearchEngineException
Check to see whether the SearchEngine is alive.- Throws:
SearchEngineException- if the SearchEngine does not respond.
-
createInputDocument
SearchInputDocument createInputDocument()
Create a SearchInputDocument that can be populated and added to the index.
-
add
void add(SearchInputDocument... docs) throws SearchEngineException
Add documents to the search index.- Throws:
SearchEngineException
-
add
void add(Collection<SearchInputDocument> docs) throws SearchEngineException
Add documents to the search index.- Throws:
SearchEngineException
-
commit
void commit() throws SearchEngineExceptionExplicitly commit all pending changes, and wait until they are visible to the search.- Throws:
SearchEngineException
-
commit
void commit(boolean wait) throws SearchEngineExceptionExplicitly commit all pending changes, and optionally wait until they are visible to the search.- Throws:
SearchEngineException
-
deleteById
void deleteById(String... ids) throws SearchEngineException
Delete documents from the search index, by unique ID.- Throws:
SearchEngineException
-
deleteById
void deleteById(Collection<String> ids) throws SearchEngineException
Delete documents from the search index, by unique ID.- Throws:
SearchEngineException
-
deleteByQuery
void deleteByQuery(String query) throws SearchEngineException
Delete documents from the search index if they satisfy the query.- Throws:
SearchEngineException
-
createQuery
SearchQuery createQuery()
Create a SearchQuery that can be populated and used for searching.
-
createQuery
SearchQuery createQuery(String queryText)
Convenience method to create a SearchQuery and set the query text in one step.
-
query
SearchResponse query(SearchQuery query) throws SearchEngineException
Query the search index and return the results. Response is never null.- Throws:
SearchEngineException
-
documentCount
int documentCount() throws SearchEngineExceptionFind the number of documents in the search index.- Throws:
SearchEngineException
-
-