# Search

3 of 5 supported
Source: https://plasapi.com/features/search-and-discovery/search/

Let patrons find works by free text, get suggestions as they type, and narrow the result with filters the library system offers.

## 1.1.1 Search — Supported

Find works by free text, with people alongside the titles.

### What you can build

A search field that returns works with their formats and availability. People come back as their own type of result, so a patron can go straight to what an author has written.

### Typical flow

1. The patron enters a search term.
2. The client sends it to `SearchWorks` and shows the works that match.
3. People from `SearchAgents` can be shown alongside.
4. The patron opens a work, or narrows the result with filters (1.1.4).

### What the API provides

- `size` is a preferred page size. The provider may return more or fewer results.
- Availability for each format comes from `GetHoldings`.

### Calls in the API

Enabled in the configuration: `GetSearchConfiguration`

Calls behind the view

- [GET /work/search](https://plasapi.com/provider/v0.6.7/work/#SearchWorks) — Search Works
- [GET /holdings](https://plasapi.com/provider/v0.6.7/holding/#GetHoldings) — Get holdings
- [GET /agent/search](https://plasapi.com/provider/v0.6.7/agent/#SearchAgents) — Search Agents

## 1.1.3 Search suggestions — Supported

Suggest works, people, subjects and searches while the patron types.

### What you can build

Suggestions under the search field that take the patron straight to a work, a person or a subject, or complete the search term.

### Typical flow

1. The patron starts typing.
2. The client calls `GetSuggestions` with what has been typed so far.
3. The patron picks a suggestion and goes straight to it, or completes the search.

### What the API provides

- A suggestion has one of four types: `work`, `contributor`, `subject` or `query`. `types` limits which ones are returned.
- `GetSearchConfiguration` tells whether the provider offers suggestions (`disabled`) and which filters they accept.

### Calls in the API

Enabled in the configuration: `GetSearchConfiguration`

- [GET /suggestions](https://plasapi.com/provider/v0.6.7/suggestion/#GetSuggestions) — Get Suggestions

## 1.1.4 Filter and sort search results — Supported

Narrow and order a search result by format, language, audience, subject and more.

### What you can build

Filters and sorting next to the result, built from what the library system actually offers. The patron only sees choices that exist at the provider.

### Typical flow

1. The client reads the available filters and sort orders from `GetSearchConfiguration`.
2. The patron chooses one or more values.
3. The client repeats the search with `filter` and `sort` on `SearchWorks`.

### What the API provides

- Values within one filter are combined with OR; different filters with AND. Example: `filter[plas.mediaTypes]=book,cd&filter[plas.subjects]=dance`.
- `facet` returns how many results each value gives, so the client can show the counts next to the choices.

### Calls in the API

In this order

1. [GET /configuration/search](https://plasapi.com/provider/v0.6.7/configuration/#GetSearchConfiguration) — Get search configuration
2. [GET /work/search](https://plasapi.com/provider/v0.6.7/work/#SearchWorks) — Search Works

## 1.1.5 Search with a query language — Not yet

Search with a query language such as CQL.

> Not in PLAS yet. This feature is not supported today. The description shows what it does, so you can see how it fits with the rest.

## 1.1.6 Advanced field search — Not yet

Search in a specific field, such as title or author.

> Not in PLAS yet. This feature is not supported today. The description shows what it does, so you can see how it fits with the rest.
