# Search extensions

This type of extension allows us to define and perform specific searches (method searches by the moment) on the backend. Like other extensions, these ones will enlarge the list of options available on the IDE.

## Specification

A search extension must be like this:

```json
{
	"type": "search",
	"elementType": "string",
	"label": "string",
	"description": "string",
	"get": "string",
	"section": "string"
}
```

Where:

* `type` this property should be `search`.
* `get` the URI to perform the actual search (see below).

For basic properties refer to [basic extension properties](/webside/api/extensions/get.md#specification).

## Example

Lets suppose we want to add a "Unary methods" search option to packages and that we count on a endpoint for that (`/packages/{packagename}/unaries` for instance), that searches for unary methods on a given package.\
We could specify our extension like this:

```json
{
	"type": "search",
	"elementType": "package",
	"label": "Unary methods",
	"get": "/packages/{element.name}/unaries"
}
```

## Get mechanism

`get` property should be the URI corresponding to the endpoint associated to the search of interest. The value might contain `{element.xxxx}` expressions, where `element` represents the meta-model object for which the search is requested (most likely the object selected in IDE), and `xxxx` is an valid attribute for such element. This expression will be replaced by the actual value element's attribute.\\

In the example, assuming the action was triggered from the package `MyPackage`, the contents will be retrieved from the URI `/pacakges/MyPackage/unaries`.

Valid attributes can be extracted from the corresponding endpoints in the documentation ([pacakges](/webside/api/code/packages/get.md), [classes](/webside/api/code/classes/get.md), [variables](/webside/api/code/classes/get-3.md), [categories](/webside/api/code/classes/get-2.md), [methods](/webside/api/code/methods/get.md)).


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://webside.gitbook.io/webside/api/extensions/searches.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
