Support and Documentation


The search panel includes a widget for invoking operations on search results. The available actions that appear in the list can vary, depending on the content type filter setting.


Brightspot provides default action implementations as reflected in the above screen shot. You can also create custom actions by implementing the SearchResultAction interface and a page servlet that operates on search results. Brightspot automatically detects new action implementations.

To implement SearchResultAction, override the following methods:

  • getGroup sets a group name in the UI for a set of related action implementations, like Bulk.

  • getPosition sets the top-down position of the action in the UI list of actions. Implementations with the same position settings are arranged in alphabetical order based on the class name.

  • shouldDisplay shows or hides the action in the UI.

  • writeHtml constructs the HTML link that invokes the action when the button is clicked in the UI. The link references the path of the page servlet that processes the search results.

The following code example shows the writeHtml implementation for the SaveSearchResultAction, which saves the search for the current result set. The method takes ToolPageContext, Search, and SearchResultSelection objects. The ToolPageContext object constructs the HTML link to the action servlet.

 public void writeHtml(
         ToolPageContext page,
         Search search,
         SearchResultSelection selection)
         throws IOException {

   page.writeStart("div", "class", "searchResult-action-simple");
               "class", "button",
               "target", "toolUserSaveSearch",
               "href", page.cmsUrl("/toolUserSaveSearch",
                       "search", page.url("", Search.NAME_PARAMETER, null)));
           page.writeHtml(page.localize(SaveSearchResultAction.class, "action.saveSearch"));

In the previous snippet—

  • Lines 12–13 construct the URL to the page servlet, specified in the servlet routing path as toolUserSaveSearch.This page servlet is located in <project>src/main/java/com/psddev/cms/tool/page.

  • Line 14 specifies the label on the action button. If Brightspot is localized, you can pass a resource key to retrieve the label for the applicable browser language. For the search result APIs in the Brightspot project, place resource files in <project>src/main/resources/com/psddev/cms/tool/search.