In this section, you’ll create the classes that control these aspects of the search functionality:
-
Registration:
EntrySearchRegistrar
registers the search service for the Entry entity.
-
Indexing:
-
EntryModelDocumentContributor
controls which Entry fields are indexed in the search engine. -
EntryModelIndexerWriterContributor
configures the re-indexing and batch re-indexing behavior for Entries. -
EntryBatchReindexer
, an interface, and itsEntryBatchReindexerImpl
, for re-indexing Entries when their Guestbook is updated.
-
-
Querying:
-
EntryKeywordQueryContributor
contributes clauses to the ongoing search query. -
EntryModelPreFilterContributor
controls how search results are filtered before they’re returned from the search engine.
-
-
Generating Result Summaries:
EntryModelSummaryContributor
constructs the result summary for Entries, including specifying which fields to use.
After creating the search classes, modify the service layer to update the search index when an Entry is persisted:
- Update
EntryLocalServiceImpl
’saddEntry
,updateEntry
, anddeleteEntry
methods to update the index so it matches the databse.