> ## Documentation Index
> Fetch the complete documentation index at: https://docs.tinyfish.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Improve Results With purpose

> Get better-matched results by telling TinySearch why you are searching using purpose

> [!NOTE]
>
> **Capability:**`purpose`

Use this when your query is a terse set of keywords and the goal behind it isn't obvious. `purpose` states why you are searching, such as the task the results will be used for, and gives the search extra signal beyond the keywords.

```python Python theme={null}
from tinyfish import TinyFish

client = TinyFish()
response = client.search.query(
    query="pdf invoice parser",
    purpose="Find an open-source library for parsing PDF invoices in Python",
)

for r in response.results:
    print(f"{r.position}. {r.title}")
```

```typescript TypeScript theme={null}
import { TinyFish } from "@tiny-fish/sdk";

const client = new TinyFish();
const response = await client.search.query({
  query: "pdf invoice parser",
  purpose: "Find an open-source library for parsing PDF invoices in Python",
});

for (const r of response.results) {
  console.log(`${r.position}. ${r.title}`);
}
```

```bash cURL theme={null}
curl -G "https://api.search.tinyfish.ai" \
  --data-urlencode "query=pdf invoice parser" \
  --data-urlencode "purpose=Find an open-source library for parsing PDF invoices in Python" \
  -H "X-API-Key: $TINYFISH_API_KEY"
```

`purpose` is always optional. Leaving it out leaves search behavior unchanged.

## Common Mistakes

> [accordion] Using purpose instead of query
>
> `purpose` adds context to a search; it does not replace it. `query` is still required.

> [accordion] Writing a long brief
>
> Keep it to a short phrase or sentence. The maximum is 2000 characters.

## Related

> [card] [Search, Then Fetch Full Page Content](https://docs.tinyfish.ai/tinysearch/how-to/search-then-fetch.md)
>
> Read the pages behind the results

> [card] [TinySearch API Reference](https://docs.tinyfish.ai/tinysearch/reference)
>
> Every parameter, accepted value, and error code


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.