---
editLink: false
lastUpdated: false
---

[@salesforce/b2c-tooling-sdk](../../modules.md) / [docs](../index.md) / searchDocs

# Function: searchDocs()

> **searchDocs**(`query`, `limitOrOptions?`): [`SearchResult`](../interfaces/SearchResult.md)[]

Defined in: [packages/b2c-tooling-sdk/src/docs/search.ts:381](https://github.com/SalesforceCommerceCloud/b2c-developer-tooling/blob/67fb8580ac3c5b372617ee3ec3fc8f2bc9f16174/packages/b2c-tooling-sdk/src/docs/search.ts#L381)

Searches the combined documentation index.

Higher scores are better. Results carry the full [DocEntry](../interfaces/DocEntry.md) (including
`category`, `summary`, `keywords`, and `url` when available) so callers can
triage matches without a follow-up read.

When `workspace` is provided, the categories relevant to those markers (e.g.
`sfra` for an SFRA project, `script-api`/`job-step` for any cartridge project,
`pwa-kit-managed-runtime`/`commerce-api` for PWA Kit, `sfnext`/`commerce-api`
for Storefront Next — plus the always-relevant docs) are boosted. It only ever
reorders results; use `category`/`enabledCategories` to hard-scope.

## Parameters

### query

`string`

The search query string

### limitOrOptions?

Result limit (number) or [SearchDocsOptions](../interfaces/SearchDocsOptions.md)

`number` | [`SearchDocsOptions`](../interfaces/SearchDocsOptions.md)

## Returns

[`SearchResult`](../interfaces/SearchResult.md)[]

Array of search results sorted by relevance (best first)

## Example

```typescript
// Favor the current workspace's docs (nothing hidden)
searchDocs('deploy bundle', {workspace: 'pwa-kit-v3'});
// Hard-scope to one category instead
searchDocs('components', {category: 'sfnext'});
```
