Skip to content

Commit 38a49ea

Browse files
committed
docs(cli): rename search text to search titles
- `text` next to the new `content` implied it searched page text - ground the name-property advice in Entity.json's @context mapping - name the jsondata slot in the content-search caveat - list `titles` and `content` in the command table
1 parent c7306a9 commit 38a49ea

3 files changed

Lines changed: 14 additions & 10 deletions

File tree

‎docs/cli-and-mcp.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ Commands are grouped by subject:
6363
| --- | --- |
6464
| `entity` | `get`, `put`, `export`, `delete` |
6565
| `file` | `info`, `cat`, `write`, `download`, `upload` |
66-
| `search` | `ask`, `text`, `instances`, `sparql` |
66+
| `search` | `ask`, `titles`, `content`, `instances`, `sparql` |
6767
| `slot` | `list`, `get`, `set` |
6868
| `schema` | `get` |
6969
| `instance` | `list` |

‎src/osw/service/ops/search.py‎

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,14 @@ def search_entities(ctx: Context, ask_query: str, limit: Optional[int] = None) -
3333
[[Category:Item]][[Keyword::sensor]]
3434
[[Category:Item]][[HasName::~*sensor*]]
3535
36-
``~`` starts a wildcard comparison and ``*`` matches any text. Which
37-
property holds the name depends on the instance's schema: ``HasName``,
38-
``Display_title_of`` and ``HasLabel`` are the usual candidates. Read the
39-
category schema (``osw schema get``) if a name query returns nothing.
36+
``~`` starts a wildcard comparison and ``*`` matches any text.
37+
38+
Which property holds a name depends on the schema. The shipped base
39+
schema maps the JSON field ``label`` to ``Property:HasLabel`` and
40+
``name`` to ``Property:HasName``, and stored queries read the displayed
41+
label as ``Display_title_of``. A category declares this mapping in the
42+
``@context`` of its schema, so read it with ``osw schema get`` when a
43+
name query returns nothing.
4044
4145
``limit`` defaults to ``OSW_MAX_RESULTS`` (100 when that is unset).
4246
Returns ``{titles, count, truncated}``, where ``titles`` are full page
@@ -52,7 +56,7 @@ def search_entities(ctx: Context, ask_query: str, limit: Optional[int] = None) -
5256

5357
@operation(
5458
group="search",
55-
cli_name="text",
59+
cli_name="titles",
5660
read_only_hint=True,
5761
idempotent_hint=True,
5862
)
@@ -88,9 +92,9 @@ def search_content(ctx: Context, text: str, limit: Optional[int] = None) -> dict
8892
"""Search the text content of pages for ``text``.
8993
9094
Uses the MediaWiki ``search`` API, which reads page wikitext. On an OSW
91-
instance an entity's data lives in JSON slots, so a value stored as
92-
structured data may not be reachable here; ``osw search ask`` queries
93-
that data directly and is the better tool for it.
95+
instance an entity's values live in its ``jsondata`` slot, not in the
96+
wikitext, so a stored value may not be reachable here; ``osw search ask``
97+
queries that data directly and is the better tool for it.
9498
9599
Returns page titles, not the matching passages. ``limit`` defaults to
96100
``OSW_MAX_RESULTS`` (100 when that is unset). Returns

‎src/osw/wtsite.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -534,7 +534,7 @@ def prefix_search(self, text: Union[str, SearchParam]):
534534

535535
@try_and_renew_token
536536
def content_search(self, text: Union[str, SearchParam]):
537-
"""Send a content (full-text) search request to the site.
537+
"""Send a search request for the text content of pages to the site.
538538
539539
Parameters
540540
----------

0 commit comments

Comments
 (0)