SearchResultField
You can select which fields appear in the search results with the Fields list in the results section of the search panel. Brightspot populates the Select Fields widget with default fields.

Using the SearchResultField interface, you can add custom fields to the widget. For example, say that you want the author name to appear for articles listed in the search results. You can implement SearchResultField
to return the Author
field for Article
objects retrieved in a query, similar to the following example.
public class AuthorField implements SearchResultField { @Override public String getDisplayName() { 1 return "Author"; } @Override public boolean isSupported(ObjectType type) { 2 return true; } @Override public String createDataCellText(Object item) { 3 Article article = State.getInstance(item).getOriginalObject() instanceof Article ? ((Article) State.getInstance(item).getOriginalObject()) : null; if (article != null) { if (article.getAuthor() != null) return article.getAuthor().getName(); else return ("No attribution"); } return null; } }
Specifies how the field label appears in the search results. | |
Determines if the field appears in the search results. If the method returns | |
Filters for |
With the new implementation, the Author
field is now available in the Select Fields widget.

With a query on articles, the Author
field is included in the search results.
