Package com.orchestranetworks.search.template

# Interface SearchTemplate

public interface SearchTemplate
The main interface to implement for a search template.

### Introduction

A search template is a configuration tool that supports:

- Predefining the scope of a search.
- Assigning field-level search strategies.

### Declaration

A search template must be registered and declared in the context of a ModuleSearchRegistrationContext.registerSearchTemplate(Supplier). After being registered, an instance of a search template can be accessed through its key using the `manager`.

### Configuration

After it is registered, a `SearchTemplate` must be configured in the `Search` extension of the DMA.

#### Scope

In this extension, the data modeler associates registered search templates to table fields; these fields constitute the scope of a search template. When an end user searches according to a template, the search is restricted to the template's scope. Note that a registered but non-configured `SearchTemplate` has no scope: a search using such a template returns no result.

#### Search strategy

The 'search' extension supports configuring instances of a search strategy and linking them to a field, in the scope of a template. When searching according to a template, each scoped field uses its corresponding strategy. If a field has no strategy defined, it uses the default strategy for its `Type`. A field can belong to multiple search templates. This way, a column can be associated with many search strategies.

### Usage

The identifier of a search template is used as a parameter in a `Request` using `osd:search` XPath function. See `Request.setXPathFilter(String)`

Since:
  6.0.0

- ## Method Summary

  Modifier and Type
  Method
  Description
  `static SearchTemplateKey`
  `defaultKey()`
  Returns a search template key that identifies the default template.
  `SearchTemplateKey`
  `getTemplateKey()`
  Returns the identifier of the search template.
  `UserMessage`
  `getUserDescription()`
  Returns the description of this template.
  `UserMessage`
  `getUserLabel()`
  Returns the label of this template.

- ## Method Details

  - ### defaultKey

    static SearchTemplateKey defaultKey()
    Returns a search template key that identifies the default template.

    See `SearchTemplateManager.getDefaultTemplate()`

  - ### getTemplateKey

    SearchTemplateKey getTemplateKey()
    Returns the identifier of the search template.

    The returned `SearchTemplateKey` must contain the current module name.

    Define a public Java constant holding the template key.

  - ### getUserLabel

    UserMessage getUserLabel()
    Returns the label of this template.

    This localized label is used mainly in the Data Model Assistant to display a user-friendly label for this extension.

  - ### getUserDescription

    UserMessage getUserDescription()
    Returns the description of this template.

    This localized description is used mainly in the Data Model Assistant to display a user-friendly label for this extension.