Interface SearchEngine
- All Superinterfaces:
AutoCloseable, Closeable
- All Known Implementing Classes:
ElasticsearchEngine, SqlSearchEngine
A full-text search engine: documents in named indexes, found by text.
A document is a Map of strings, numbers, booleans, lists and nested maps;
every string in it is searchable. Index names are lowercase letters, digits,
- and _, the subset every engine accepts.
-
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Releases connections.booleanRemoves a document; returns whether there was one.voiddeleteIndex(String index) Removes an index and every document in it; a missing one is not an error.The document stored underid, or null.voidAdds a document underid, replacing any already there.voidMakes every write so far visible tosearch(String, SearchQuery).search(String index, SearchQuery query) Runs a query.
-
Method Details
-
index
Adds a document underid, replacing any already there.- Throws:
IOException
-
delete
Removes a document; returns whether there was one.- Throws:
IOException
-
get
The document stored underid, or null.- Throws:
IOException
-
search
Runs a query.- Throws:
IOException
-
refresh
Makes every write so far visible tosearch(String, SearchQuery). Search clusters publish writes about once a second; tests and read-your-write flows call this.- Throws:
IOException
-
deleteIndex
Removes an index and every document in it; a missing one is not an error.- Throws:
IOException
-
close
void close()Releases connections. An engine fromSearchEngines.current()is closed by the server and must not be closed by the caller.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable
-