Class ElasticSearchEngine
- java.lang.Object
-
- edu.cornell.mannlib.vitro.webapp.searchengine.elasticsearch.ElasticSearchEngine
-
- All Implemented Interfaces:
Application.Component,Application.Module,SearchEngine
public class ElasticSearchEngine extends Object implements SearchEngine
A first draft of an Elasticsearch implementation.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface edu.cornell.mannlib.vitro.webapp.modules.Application.Component
Application.Component.LifecycleState
-
-
Constructor Summary
Constructors Constructor Description ElasticSearchEngine()
-
Method Summary
All Methods Instance Methods Concrete 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.voidsetBaseUrl(String url)voidshutdown(Application application)This should be called only once, and should be the last call on this Component.voidstartup(Application application, ComponentStartupStatus ss)This should be called only once, and should be the first call on this Component.voidvalidate()
-
-
-
Method Detail
-
setBaseUrl
public void setBaseUrl(String url)
-
startup
public void startup(Application application, ComponentStartupStatus ss)
Description copied from interface:Application.ComponentThis should be called only once, and should be the first call on this Component.- Specified by:
startupin interfaceApplication.Component
-
shutdown
public void shutdown(Application application)
Description copied from interface:Application.ComponentThis should be called only once, and should be the last call on this Component.- Specified by:
shutdownin interfaceApplication.Component
-
ping
public void ping() throws SearchEngineExceptionDescription copied from interface:SearchEngineCheck to see whether the SearchEngine is alive.- Specified by:
pingin interfaceSearchEngine- Throws:
SearchEngineException- if the SearchEngine does not respond.
-
createInputDocument
public SearchInputDocument createInputDocument()
Description copied from interface:SearchEngineCreate a SearchInputDocument that can be populated and added to the index.- Specified by:
createInputDocumentin interfaceSearchEngine
-
add
public void add(SearchInputDocument... docs) throws SearchEngineException
Description copied from interface:SearchEngineAdd documents to the search index.- Specified by:
addin interfaceSearchEngine- Throws:
SearchEngineException
-
add
public void add(Collection<SearchInputDocument> docs) throws SearchEngineException
Description copied from interface:SearchEngineAdd documents to the search index.- Specified by:
addin interfaceSearchEngine- Throws:
SearchEngineException
-
commit
public void commit() throws SearchEngineExceptionDescription copied from interface:SearchEngineExplicitly commit all pending changes, and wait until they are visible to the search.- Specified by:
commitin interfaceSearchEngine- Throws:
SearchEngineException
-
commit
public void commit(boolean wait) throws SearchEngineExceptionDescription copied from interface:SearchEngineExplicitly commit all pending changes, and optionally wait until they are visible to the search.- Specified by:
commitin interfaceSearchEngine- Throws:
SearchEngineException
-
deleteById
public void deleteById(String... ids) throws SearchEngineException
Description copied from interface:SearchEngineDelete documents from the search index, by unique ID.- Specified by:
deleteByIdin interfaceSearchEngine- Throws:
SearchEngineException
-
deleteById
public void deleteById(Collection<String> ids) throws SearchEngineException
Description copied from interface:SearchEngineDelete documents from the search index, by unique ID.- Specified by:
deleteByIdin interfaceSearchEngine- Throws:
SearchEngineException
-
deleteByQuery
public void deleteByQuery(String query) throws SearchEngineException
Description copied from interface:SearchEngineDelete documents from the search index if they satisfy the query.- Specified by:
deleteByQueryin interfaceSearchEngine- Throws:
SearchEngineException
-
createQuery
public SearchQuery createQuery()
Description copied from interface:SearchEngineCreate a SearchQuery that can be populated and used for searching.- Specified by:
createQueryin interfaceSearchEngine
-
createQuery
public SearchQuery createQuery(String queryText)
Description copied from interface:SearchEngineConvenience method to create a SearchQuery and set the query text in one step.- Specified by:
createQueryin interfaceSearchEngine
-
query
public SearchResponse query(SearchQuery query) throws SearchEngineException
Description copied from interface:SearchEngineQuery the search index and return the results. Response is never null.- Specified by:
queryin interfaceSearchEngine- Throws:
SearchEngineException
-
documentCount
public int documentCount() throws SearchEngineExceptionDescription copied from interface:SearchEngineFind the number of documents in the search index.- Specified by:
documentCountin interfaceSearchEngine- Throws:
SearchEngineException
-
-