gizmodel/sql/types/tsdict
import * as Tsdict from "gizmodel/sql/types/tsdict";Types
TsObject
type TsObject = { name: string; text: string; }A text search object CREATE TEXT SEARCH made, as the catalog keeps it.
name:stringtext:string
TsObjects
type TsObjects = { dictionaries: Vec<TsObject>; configurations: Vec<TsObject>; templates: Vec<TsObject>; parsers: Vec<TsObject>; }The text search objects of one snapshot: this module reads them as data, the caller from the catalog.
dictionaries:Vec<M165.TsObject>configurations:Vec<M165.TsObject>templates:Vec<M165.TsObject>parsers:Vec<M165.TsObject>
TsChange
type TsChange = { text: string; made: bool; }What CREATE or ALTER of a dictionary or configuration stores under its name; made when ALTER is complete with it.
text:stringmade:bool
TsLex
type TsLex = { word: string; nvariant: i64; flags: i64; }A lexeme a dictionary gives: its text, its variant (the lexemes of one variant go together) and TSL_* flags.
word:stringnvariant:i64flags:i64
TsDict
type TsDict = { name: string; template: string; stop: string; accept: bool; syn: Map<string, i64>; synOut: Vec<TsLex>; caseSensitive: bool; sp: Ispell; th: Thesaurus; sub: i64; }A dictionary: its template and the data it needs. STOP names its stop word list ("" for none).
name:stringtemplate:stringstop:stringaccept:boolsyn:_gizlang_sdk_collections.Map<string, i64>synOut:Vec<M165.TsLex>caseSensitive:boolsp:M165.Ispellth:M165.Thesaurussub:i64
TsConfig
type TsConfig = { name: string; maps: Vec<Vec<i64>>; }A configuration: the dictionaries of each token type, by type id (0 unused).
name:stringmaps:Vec<Vec<i64>>
TsEnv
type TsEnv = { configs: Vec<TsConfig>; dicts: Vec<TsDict>; }The dictionaries and configurations a statement sees.
configs:Vec<M165.TsConfig>dicts:Vec<M165.TsDict>
DictLexemes
type DictLexemes = { dict: string; lexemes: Vec<string>; }A dictionary and the lexemes it gave.
dict:stringlexemes:Vec<string>
TsToken
type TsToken = { t: i64; text: string; }A token: its type (0 ends the text) and text.
t:i64text:string
Functions
tokenTypes
function tokenTypes(): Vec<Vec<string>>The default parser's token types: alias and description, by id from 1.
Effects: fail, alloc.
dictInitOption
function dictInitOption(text: string): Option<string>The options as dictinitoption shows them, the template left out; none when there are no others.
Effects: fail, alloc.
dictTemplate
function dictTemplate(text: string): stringThe template of a dictionary's stored options, schema left out.
Effects: fail, alloc.
builtinTsEnv
function builtinTsEnv(): TsEnvThe built-in dictionaries (simple and english_stem) and configurations (simple and english).
Effects: fail, alloc.
findConfig
function findConfig(env: TsEnv, name: string): i64 throws DbErrorThe configuration named NAME, 42704 when there is none.
Effects: fail, alloc.
tsLexize
function tsLexize(env: TsEnv, dictionary: string, word: string): Option<Vec<string>> throws DbErrorts_lexize(dictionary, word); 42704 for an unknown dictionary.
Effects: fail, alloc.
tokenLexize
function tokenLexize(env: TsEnv, cfg: i64, t: i64, word: string): Option<DictLexemes> throws DbErrorThe first dictionary of configuration CFG for token type T that knows WORD, and its lexemes (ts_debug); none when no dictionary knows it.
Effects: fail, alloc.
configDicts
function configDicts(env: TsEnv, cfg: i64, t: i64): Vec<string>The names of the dictionaries configuration CFG sends token type T to.
Effects: fail, alloc.
lexizeTokens
function lexizeTokens(env: TsEnv, cfg: i64, tokens: Vec<TsToken>): Vec<Vec<TsLex>> throws DbErrorThe lexemes of a text's tokens through configuration CFG (parsetext): one list for each word or phrase a dictionary took, in order; a stop word gives an empty list.
Effects: fail, alloc.
textSearchEnv
function textSearchEnv(objects: TsObjects): TsEnvThe dictionaries and configurations of OBJECTS: the built-in ones, then those CREATE TEXT SEARCH made (a thesaurus after the others, as it lexizes its words through another); one that no longer builds is left out.
Effects: fail, console, alloc.
hasTextSearchObjects
function hasTextSearchObjects(objects: TsObjects): boolWhether OBJECTS hold a dictionary or configuration CREATE TEXT SEARCH made.
textSearchChange
function textSearchChange(objects: TsObjects, action: string, what: string, name: string, text: string, notices: mut Vec<string>): Option<TsChange> throws DbErrorCREATE or ALTER TEXT SEARCH DICTIONARY or CONFIGURATION NAME with TEXT (what follows the name): the text to store for CREATE; for ALTER of a dictionary's options or a configuration's mapping, the change is made here and the result is "" . None for the other statements (RENAME, OWNER TO, SET SCHEMA, DROP), which the caller makes.
Effects: fail, console, alloc.
Constants
TSL_ADDPOS
const TSL_ADDPOS: i64 = 1TSLexeme flags: one position more before this lexeme, a prefix match, and a lexeme for the next dictionary.
TSL_PREFIX
const TSL_PREFIX: i64 = 2TSLexeme flag: a prefix match.
DICTIONARY
const DICTIONARY = "pg text search dictionary"The catalog kind of a text search dictionary.
CONFIGURATION
const CONFIGURATION = "pg text search configuration"The catalog kind of a text search configuration.
TEMPLATE
const TEMPLATE = "pg text search template"The catalog kind of a text search template.
PARSER
const PARSER = "pg text search parser"The catalog kind of a text search parser.