Now you’ll create the classes that control these aspects of the search functionality:
-
Registration:
GuestbookEntrySearchRegistrar
registers the search service for theGuestbookEntry
entity.
-
Indexing:
-
GuestbookEntryModelDocumentContributor
controls whichGuestbookEntry
fields are indexed in the search engine. -
GuestbookEntryModelIndexerWriterContributor
configures the re-indexing and batch re-indexing behavior forGuestbookEntry
s. -
GuestbookEntryBatchReindexer
, an interface, and itsGuestbookEntryBatchReindexerImpl
, for re-indexingGuestbookEntries
when their Guestbook is updated.
-
-
Querying:
-
GuestbookEntryKeywordQueryContributor
contributes clauses to the ongoing search query. -
GuestbookEntryModelPreFilterContributor
controls how search results are filtered before they’re returned from the search engine.
-
-
Generating Result Summaries:
GuestbookEntryModelSummaryContributor
constructs the result summary forGuestbookEntry
s, including specifying which fields to use.
After creating the search classes, modify the service layer to update the search
index when a GuestbookEntry
is persisted:
- Update
GuestbookEntryLocalServiceImpl
’saddEntry
,updateEntry
, anddeleteEntry
methods to update the index so it matches the database.