In this section, you’ll create the classes that control these aspects of the search functionality:
GuestbookSearchRegistrarregisters the search services to the search framework for the Guestbook entity.
GuestbookModelDocumentContributorcontrols which Guestbook fields are indexed in the search engine.
GuestbookModelIndexerWriterContributorconfigures the re-indexing and batch re-indexing behavior for Guestbooks.
GuestbookKeywordQueryContributorcontributes clauses to the ongoing search query.
GuestbookModelPreFilterContributorcontrols how search results are filtered before they’re returned from the search engine.
Generating Result Summaries:
GuestbookModelSummaryContributorconstructs the result summary for Guestbooks, including specifying which fields to use.
After creating the search classes, you’ll modify the service layer to update the
search index when a guestbook is persisted. Specifically,
deleteGuestbook methods are updated to invoke the guestbook indexer.
In prior versions of Liferay DXP, search and indexing was accomplished with one
*Indexer class that extended
BaseIndexer. In Liferay DXP 7.1 is a new pattern
that relies on composition instead of
If you want to use the old approach, feel free to extend
Since there’s no reason to search for guestbooks in the UI, only back-end work is necessary.