Enabling Search and Indexing for Entries

Now you’ll create the classes that control these aspects of the search functionality:

  • Registration:

    • GuestbookEntrySearchRegistrar registers the search service for the GuestbookEntry entity.
  • Indexing:

    • GuestbookEntryModelDocumentContributor controls which GuestbookEntry fields are indexed in the search engine.

    • GuestbookEntryModelIndexerWriterContributor configures the re-indexing and batch re-indexing behavior for GuestbookEntrys.

    • GuestbookEntryBatchReindexer, an interface, and its GuestbookEntryBatchReindexerImpl, for re-indexing GuestbookEntrieswhen 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 for GuestbookEntrys, including specifying which fields to use.

After creating the search classes, modify the service layer to update the search index when a GuestbookEntryis persisted:

  • Update GuestbookEntryLocalServiceImpl’s addEntry, updateEntry, and deleteEntry methods to update the index so it matches the database.

Let’s Go!

« Handling Indexing in the Guestbook Service LayerRegistering Entries with the Search Framework »
この記事は役に立ちましたか?
0人中0人がこの記事が役に立ったと言っています