Built-in services · rule
search.undeclared
A query searches an entity by words that has no search: section.
Area 16, Built-in services; not declinable; the next step is usually the agent's.
Why Jadpo refuses it
A query finds records by words only in the fields its entity's
search: lists: that section is where the compiler gets the column of
words it keeps up to date, its index and its language. Without one there
is nothing to search, and Jadpo won't pick the fields for you, since
which fields people search by, and which come first, is the entity's
decision. Here Todo has no search::
What it looks like
main.jadpo:
type TodoTitle = Text { max_length: 200}entity Todo { id: Uuid title: TodoTitle}type TodoView = Output { pick: [Todo.id, Todo.title]}query search_todos(phrase: SearchText) -> List<TodoView> { from: Todo where: Todo matches phrase limit: 20}
error Todo has no search:, so its records can't be found by words
--> main.jadpo:16:12
|16 | where: Todo matches phrase | ^^^^^^^^^^^^^^^^^^^ no `search:`
- reason
- A query finds records by words only in the fields its entity's
search:lists, which the compiler indexes;Todohas nosearch:section. - next
- Add
search: { fields: [...] language: SearchLanguage.english }toTodo, listing the text fields people search by (agent) - rule
- search.
undeclared - help
- https://jadpo.
dev/docs/errors/search. undeclared
(agent) at the end of the next: line means your coding agent can make
the fix itself.
How to fix it
If people should search todos by their titles, give the entity a
search:, listing the text fields they search by, the one counting most
first, and their language:
entity Todo { id: Uuid title: TodoTitle search: { fields: [title] language: SearchLanguage.english }}
The next jadpo migrate new adds the column of words and its index, and
the query finds the best matches first.
Related
Markdown for agents: /docs/errors/search.undeclared.md.Built from Jadpo main at e00e61f.