import Since from '@components/shared/Since.astro' import RailroadDiagram from '@components/RailroadDiagram.astro' import Tabs from '@components/Tabs/Tabs.astro' import TabItem from '@components/Tabs/TabItem.astro'

ALTER ANALYZER statement

The ALTER ANALYZER statement can be used to modify an existing defined analyzer.

Statement syntax

SurrealQL Syntax

ALTER ANALYZER [ IF EXISTS ] @name
[ FUNCTION fn::@function | DROP FUNCTION ]
[ TOKENIZERS @tokenizer, ... | DROP TOKENIZERS ]
[ FILTERS @filter, ... | DROP FILTERS ]
[ COMMENT @string | DROP COMMENT ]

Example usage

-- Define an analyzer
DEFINE ANALYZER example_edgengram TOKENIZERS class FILTERS edgengram(1,3);

-- Shorten the edgengram
ALTER ANALYZER example_edgengram FILTERS edgengram(1,2);

-- Check the output
search::analyze("example_edgengram", "Apple banana!!");

Output

[
'A',
'Ap',
'b',
'ba',
'!',
'!!'
]