Interface SearchMatchPlugin


public interface SearchMatchPlugin
A contribution to the keyword search of one unified-search content type: an add-on that holds searchable data about objects of another add-on (for instance values typed in a form attached to a note, an article or a space) names the objects matching the keyword, and what matched, so that they appear among that content type's results.

The host adds the contributed ids to its own query, inside the clause that holds the viewer's permissions and every other filter: a contributed object the viewer may not see by the host's own rule is never returned. The matched fields are attached only to the objects the host returns. The host reaches the contributors through io.meeds.social.search.service.SearchMatchService#collect, which merges them, and never calls a contributor itself.

A contributor is a Spring @Service with an explicit, unique bean name, non-final, looked up by type when a search runs; it carries no business logic and delegates to its add-on's service layer.

Since:
8.0
  • Method Summary

    Modifier and Type
    Method
    Description
    The unified-search content type this contributor adds results to: the contentType of the host's search connector, for instance notes, news, space, task or document.
    Finds the objects matching a keyword in the contributor's own data, for one viewer.
  • Method Details

    • getContentType

      String getContentType()
      The unified-search content type this contributor adds results to: the contentType of the host's search connector, for instance notes, news, space, task or document.
      Returns:
      the content type, never null
    • search

      Finds the objects matching a keyword in the contributor's own data, for one viewer. Called once per keyword search, on the request thread: the contributor bounds its backend request by a deadline and its preparation by size, and answers an empty result, never an exception, when its backend is unavailable. The host adds no timeout of its own.
      Parameters:
      request - the viewer, the keyword, the spaces the search is restricted to, the number of results wanted and the viewer's locale
      Returns:
      the matching object ids, best first, and what matched for each, never null