Find text in parsed task source content

Find text in parsed source content within a task.

POST https://api.moi.matrixorigin.cn/v5/semantic-models/runtime/search-document

Before you call this API

Use only the injected service address, technical credentials, workspace, and short-lived authorization in the current task environment. Preserve the original authorization header. An ordinary PAT neither replaces task identity nor establishes authorization. Examples use jq. See common information for variables, objects, and states.

Request body

curl -X POST "${MOI_ENDPOINT%/}/semantic-models/runtime/search-document" \
  -H "X-API-Key: $MOI_API_KEY" \
  -H "X-Workspace-ID: $MOI_WORKSPACE_ID" \
  -H "X-MOI-Runtime-Authorization: $MOI_RUNTIME_AUTHORIZATION" \
  -H 'Content-Type: application/json' \
  --data-binary "$(jq -n --arg REQUEST_ID "$REQUEST_ID" --arg MARKDOWN_FILE_ID "$MARKDOWN_FILE_ID" --arg KNOWLEDGE_QUERY "$KNOWLEDGE_QUERY" '
{
  "request_id": $REQUEST_ID,
  "markdown_file_id": $MARKDOWN_FILE_ID,
  "query": $KNOWLEDGE_QUERY,
  "max_matches": 5,
  "context_chars": 600
}
')"

Find literal text in the current effective source projection, without semantic retrieval. total_matches is the total match count; truncated indicates incomplete returned snippets.

Field

Type

Required

Description

request_id

string

Yes

Unique operation ID, 1–256 bytes, without leading/trailing whitespace or an audit: prefix. Retain it when replaying identical input.

markdown_file_id

string

Yes

Markdown location ID from the original evidence.

query

string

Yes

Nonempty query text.

max_matches

integer

No

Nonpositive/omitted uses 5; maximum 20.

context_chars

integer

No

Nonpositive/omitted uses 600; maximum 2000.

Successful response

{
  "code": "OK",
  "msg": "OK",
  "data": {
    "call_id": "request_example",
    "output": {
      "markdown_file_id": "markdown_example",
      "file_name": "example.md",
      "query": "example",
      "total_chars": 0,
      "matches": [],
      "total_matches": 0,
      "truncated": false,
      "metadata": {}
    }
  }
}

Field

Type

Description

code

string

OK on success.

msg

string

Response description.

data.call_id

string

Corresponding original request_id.

data.failed

boolean

true indicates business failure; false may be omitted.

data.output

object

Current operation result.

data.artifacts

object (array of objects)

Original artifacts and evidence from the same task.

data.metadata

object

Operation metadata, when present.

data.output.markdown_file_id

string

Raw value returned by the current operation; retain according to common objects.

data.output.file_name

string

Raw value returned by the current operation; retain according to common objects.

data.output.query

string

Raw value returned by the current operation; retain according to common objects.

data.output.total_chars

integer

Raw value returned by the current operation; retain according to common objects.

data.output.matches

array

Returned match positions and context snippets.

data.output.total_matches

integer

Total matches in the original content.

data.output.truncated

boolean

Whether current results are truncated.

data.output.metadata

object

Raw value returned by the current operation; retain according to common objects.

Error responses

Handle HTTP status, business results, and error fields. See errors and environments. On source/version conflicts, read current state rather than automatically replacing identities, resources, or request IDs and retrying.

Last updated on