Enabling Search and Indexing for Entries

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 its EntryBatchReindexerImpl, 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’s addEntry, updateEntry, and deleteEntry methods to update the index so it matches the databse.

Let’s Go!

« Handling Indexing in the Guestbook Service LayerRegistering Entries with the Search Framework »
Was this article helpful?
0 out of 0 found this helpful