> For the complete documentation index, see [llms.txt](https://docs.shiftiq.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.shiftiq.com/contributors/implementation/front-end/shift.ui/ui-search.md).

# Search

Standardized patterns developers can follow to create a consistent and user-friendly experience

I’ll be using Gradebook Search screen as an example

1. Create an interface for the API Row model (ApiGradebookMatch) and API Query model (ApiSearchGradebooks)\\

   <figure><img src="https://4144393940-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F7KmmYRiwSx7C9b3NlN4E%2Fuploads%2Fgit-blob-73ff7d0dbdca751caa878ddd81425808a5320ca5%2Fsearch-api-models.jpg?alt=media" alt="Search api models"><figcaption></figcaption></figure>
2. Add search and download methods to the controller object:

   <figure><img src="https://4144393940-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F7KmmYRiwSx7C9b3NlN4E%2Fuploads%2Fgit-blob-edd9682bddf570a8c4c58b327e9bdf2c39f8ed29%2Fsearch-api-functions.jpg?alt=media" alt="Search api functions"><figcaption></figcaption></figure>
3. Go to cacheKey.ts and add a new unique key to the union type CacheKey
4. Create a new folder /src/routes/admin/records/gradebooks/search\
   This folder will contain code related to Gradebook Search form
5. Create a new file GradebookRow\.ts with interface GradebookRow and the function toGradebookRow\\
   * GradebookRow provides properties used by Result Grid.
   * toGradebookRow converts ApiGradebookMatch to GradebookRow
6. Create a new file GradebookCriteria.ts with the interface GradebookCriteria and functions defaultGradebookCriteria and toApiSearchGradebooks
7. Create a new file Gradebook\_Search.tsx and specify all criteria input field here
8. Create a new file GradebookSearch\_Result.tsx and specify all Result Grid fields here
9. Create a new file GradebookSearch\_Download.tsx and specify all download fields here
10. Create a new file GradebookSearch.tsx that joins Search, Result, and Download components.
11. Add a new Search form to routes in the file /src/routes/formRoutes.tsx:

    <figure><img src="https://4144393940-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F7KmmYRiwSx7C9b3NlN4E%2Fuploads%2Fgit-blob-3b24195c27b410751937cff3bdc7f278284a210d%2Fsearch-menu.jpg?alt=media" alt="Search menu"><figcaption></figcaption></figure>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

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

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.shiftiq.com/contributors/implementation/front-end/shift.ui/ui-search.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
