Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Search

Methods to search text across the open packs, the dependencies and the schema, and replace it.

The server keeps the matches of the last search, so clients get a summary when running it, read the matches they need with ListSearchMatches, and replace them by ID.

search.report

Returns the last search with all its matches, as the search returns them.

Meant for clients showing the matches with all their details. Others should use search.matches.

Params (GetSearchReport)

Empty object: {}.

Result (SearchReport)

NameTypeRequiredDescription
searchanyyesThe search, with its matches.
first_idsmap of array of integeryesID of the first match of each file, by type of file, in the order of the files in the search. The other matches of a file follow it, so its match number n has the ID first + n.

search.run

Searches text, keeping the matches for search.matches.

Runs as a job: answers right away with a job ID, and sends its result when the job ends (see Jobs).

Params (RunSearch)

NameTypeRequiredDescription
patternstringyesText to search, or a regular expression if use_regex is set.
case_sensitivebooleanno, default falseIf the search is case sensitive.
use_regexbooleanno, default falseIf the pattern is a regular expression.
sourcesarray of FileSourceyesWhere to search: open packs, the game files, the parent packs, or the Assembly Kit tables.
file_typesarray of string or nullnoTypes of files to search, named like in files.list: DB, Loc, Text, Atlas, PortraitSettings, RigidModel, UnitVariant, AnimFragmentBattle, binary types like Image, Audio or Unknown, or Schema for the column names of the schema. Defaults to DB, Loc and Text.

Result (SearchSummary)

NameTypeRequiredDescription
totalintegeryesAmount of matches.
filesintegeryesAmount of files with matches.
by_typemap of integeryesAmount of matches in each type of file.

search.matches

Returns matches of the last search, optionally filtered.

Params (ListSearchMatches)

NameTypeRequiredDescription
file_typesarray of string or nullnoIf set, only matches in these types of files are returned.
path_prefixstringno, default ""Only matches in files whose path starts with this are returned.
offsetintegerno, default 0Amount of matching matches to skip.
limitinteger or nullnoMaximum amount of matches to return. Defaults to 100.

Result (SearchMatchList)

NameTypeRequiredDescription
matchesarray of SearchMatchyesThe matches in the page.
totalintegeryesAmount of matches matching the request, in all pages.

search.replace

Replaces matches of the last search, and searches the edited files again.

Only matches in open packs can be replaced, and only in tables, text files, atlases, portrait settings, rigid models, unit variants and anim fragment battles.

Params (ReplaceSearchMatches)

NameTypeRequiredDescription
replace_textstringyesText to replace the matches with.
matchesarray of integer or nullnoIDs of the matches to replace. If not set, all the matches are replaced.

Result (SearchReplaced)

NameTypeRequiredDescription
editedarray of stringyesPaths of the edited files.
summarySearchSummaryyesSummary of the matches left after searching the edited files again.

Types

Type FileSource

Where a file is.

One of:

  • { "pack": … }: An open pack, by key.
    • pack (string, yes)
  • "game_files": The vanilla files of the selected game.
  • "parent_files": The files of the parent packs of the open packs.
  • "assembly_kit": The tables of the selected game’s Assembly Kit. Their paths are db/<table_name>/ak_data.

Type SearchMatch

A match of a search.

NameTypeRequiredDescription
idintegeryesID of the match, used to replace it. IDs change after every search and replace.
sourceFileSource or nullnoWhere the file with the match is. Not set for matches in the schema.
pathstringyesPath of the file with the match. Empty for matches in the schema.
file_typestringyesType of the file with the match, like DB or Text.
detailsanyyesWhere the match is in its file, and its text. The fields depend on the type of the file: tables have column_name, row_number, start, end and text, text files have row, start, end and text, and so on.

Type SearchSummary

Summary of the matches of a search.

NameTypeRequiredDescription
totalintegeryesAmount of matches.
filesintegeryesAmount of files with matches.
by_typemap of integeryesAmount of matches in each type of file.