Class SearchIndexer
java.lang.Object
com.codename1.backend.search.SearchIndexer
- All Implemented Interfaces:
com.codename1.impl.orm.CommitObserver
Keeps the index of each @Searchable entity in step with what a session
committed. The ORM installs one on every session it opens inside a server;
an application does not create it.
The index is written after the data is durable, so a failure here cannot undo the commit: it is logged, and the entity is indexed again the next time it is written.
-
Field Summary
Fields inherited from interface com.codename1.impl.orm.CommitObserver
PERSISTED, REMOVED, UPDATED -
Method Summary
Modifier and TypeMethodDescriptionvoidentityofmodelwas written witheventby a transaction that has committed.static StringdocumentId(com.codename1.impl.orm.EntityModel model, Object id) The search document id of the entity whose identifier isid(whatSession.findtakes): its columns joined by:.static SearchIndexerThe indexer for a session opened by the calling thread, or null outside a server, where there is no search engine to write to.static SearchIndexerto(SearchEngine engine) An indexer writing toengine, for a session opened outside a server (SessionImpl.setCommitObserver).
-
Method Details
-
forServer
The indexer for a session opened by the calling thread, or null outside a server, where there is no search engine to write to. -
to
An indexer writing toengine, for a session opened outside a server (SessionImpl.setCommitObserver). The caller keeps ownership of it. -
committed
Description copied from interface:com.codename1.impl.orm.CommitObserverentityofmodelwas written witheventby a transaction that has committed. The data is already durable: an exception thrown here does not stop the other writes being delivered, and reaches the caller ofcommitTransactiononly after the commit, with the session intact.- Specified by:
committedin interfacecom.codename1.impl.orm.CommitObserver
-
documentId
The search document id of the entity whose identifier isid(whatSession.findtakes): its columns joined by:. ASCII letters, digits,-and_stand as they are; every other character,.and:included, is written.and four hex digits. So42and a UUID are unchanged,a@b.comisa.0040b.002ecom, no two keys share an id, and every id fits the alphabet Elasticsearch's document paths accept.
-