Now you have working Guestbook and Guestbook Admin portlets. The Guestbook portlet lets users add, edit, delete, and configure permissions for guestbook entries. The Guestbook Admin portlet lets site administrators create, edit, delete, and configure permissions for guestbooks. In the case of a very popular event (maybe a Lunar Luau dinner at the Lunar Resort), there could be many guestbook entries in the portlet, and users might want to search for entries that mentioned the delicious low-gravity ham that was served (melts in your mouth). Searching for the word ham should display these entries. In short, guestbook entries must be searchable via a search bar in the Guestbook portlet.

To enable search, you’ll add an indexer for guestbooks and their entries. Although you probably won’t have enough guestbooks in a site to warrant searching the Guestbook Admin portlet, creating a guestbook indexer has other benefits. In a later section, you’ll asset-enable guestbooks and guestbook entries so Liferay Portal’s Asset Publisher can display them. Enabling search is a prerequisite for this–you must index any entity that you want to make an asset.

But assets are for later. Right now it’s time to create those indexers. Ready?


Figure 1: You’ll add a search bar to the Guestbook portlet so that users can search for guestbook entries. If a guestbook entry’s message or name matches the search query, the entry is displayed in the search results.

Let’s Go!

Enabling Search and Indexing for Guestbooks

In this section, you first create an indexer for guestbooks. You then modify the service layer to use this indexer to update the search index when a guestbook is persisted: Create a...

Read More

Enabling Search and Indexing for Guestbook Entries

Enabling search for guestbook entries in the Guestbook portlet takes two steps: Create an EntryIndexer class that extends Liferay Portal’s BaseIndexer abstract class. Update EntryLocalServiceImpl’s...

Read More

Updating Your User Interface For Search

Updating the Guestbook portlet’s user interface for search takes two steps: Update the Guestbook portlet’s default view JSP to display a search bar for submitting queries. Create a new JSP for the...

Read More
0 (0 Votes)
Adding Messages to JSPs Previous