# `cli.search_arguments`

A `jadpo search` command names no action or one it doesn't have, or an entity the project doesn't declare or doesn't search in an engine.

Area 14, [Tools](/docs/tooling.md); not declinable; the next step is usually the agent's.

## Why Jadpo refuses it

`jadpo search reindex <Entity>` rebuilds one entity's index in the
search engine its `search:` names, from the entity's records. It never
guesses which action or entity was meant, and an entity searched on
PostgreSQL has no index to rebuild: its words are kept in each record's
own row, and PostgreSQL keeps them up to date with every write.

## What it looks like

A shop whose products are searched by name, on PostgreSQL:



domains/shop/entities/product.jadpo:

```jadpo
use shop/types { ProductName }

/// Something the shop sells, found by its name.
entity Product {
    id: Uuid
    name: ProductName

    policy: {
        read: [Access.public]
    }

    search: {
        fields: [name]
        language: SearchLanguage.english
    }
}
```

An action misspelt is refused with the one nearest:

```sh
jadpo search reindx Product
```

```text
error: `reindx` isn't something `jadpo search` does
  reason: `jadpo search reindex` rebuilds an entity's index in its engine. Did you mean `reindex`?
  next: Use `reindex` instead of `reindx` (agent)
  rule: cli.search_arguments
  help: https://jadpo.dev/docs/errors/cli.search_arguments
```

`(agent)` at the end of the `next:` line means your coding agent can make
the fix itself.

An entity searched on PostgreSQL has nothing to rebuild:

```sh
jadpo search reindex Product
```

```text
error: `Product` isn't searched in an engine
  reason: `Product` is searched on PostgreSQL, whose words are kept in each record's own row, so there is no index to rebuild.
  next: Leave out the reindex: PostgreSQL keeps `Product`'s words up to date as each record changes (agent)
  rule: cli.search_arguments
  help: https://jadpo.dev/docs/errors/cli.search_arguments
```

## How to fix it

**If the action or the entity is misspelt**, use the one the command
names:

```sh
jadpo search reindex Product
```

It rebuilds the index of `Product`, when its `search:` names an engine.

**If the entity is searched on PostgreSQL**, leave the reindex out.
Every search reads the words its records hold now, as its tests show:

```sh
jadpo test
```

Each search answers from the records as they are. Only an entity whose
`search:` has a `store:` naming an engine's connection keeps its words
in an index of its own, which `jadpo search reindex` rebuilds.

## Related

- [`jadpo search reindex`](/docs/commands-for-batches-deploys-and-search-indexes.md#jadpo-search-reindex)
- [An engine instead of PostgreSQL](/docs/search.md#an-engine-instead-of-postgresql)
