Support and Documentation

@ToolUi.ExcludeFromGlobalSearch

Applies to: Class

Excludes or includes indexed instances of the annotated content type from results in the search panel. Used with the annotation @Content.Searchable.

The following table lists the elements available with this annotation.

Element

Description

Valid Value

value

If true or absent, Brightspot excludes instances of this content type from search results.

If false, Brightspot includes instances of this content type in search results.

true (default), false

This annotation is inherited, so models extending from an annotated model have the same setting for @ToolUi.ExcludeFromGlobalSearch.

The following snippets include examples of applying this annotation.

Example 20. Class excluded from search panel
package content.article;

import com.psddev.cms.db.ToolUi;

@Content.Searchable
@ToolUi.ExcludeFromGlobalSearch
public class Article extends Content {

}


In the previous snippet—

  • Line 5 ensures Solr indexes instances of Article.

  • Line 6 excludes instances of Article from the results in the search panel.

package content.recipe;

import com.psddev.cms.db.ToolUi;
import content.article

@Content.ExcludeFromGlobalSearch(false)
public class Recipe extends Article {

}

In the previous snippet—

  • Line 7 specifies that Recipe extends from Article (the class you declared in the snippet Class excluded from search panel). Therefore, Solr indexes instances of Recipe objects but excludes them from results in the search panel.

  • Line 6 sets @ToolUi.ExcludeFromGlobalSearch to false, reversing the effect of the inherited annotation and including instances of Recipe in the search results.