doc-exports/docs/dws/dev/dws_06_0146.html
Lu, Huayi e6fa411af0 DWS DEV 830.201 version
Reviewed-by: Pruthi, Vineet <vineet.pruthi@t-systems.com>
Co-authored-by: Lu, Huayi <luhuayi@huawei.com>
Co-committed-by: Lu, Huayi <luhuayi@huawei.com>
2024-05-16 07:24:04 +00:00

78 lines
14 KiB
HTML

<a name="EN-US_TOPIC_0000001188429044"></a><a name="EN-US_TOPIC_0000001188429044"></a>
<h1 class="topictitle1">ALTER TEXT SEARCH DICTIONARY</h1>
<div id="body1560407392208"><div class="section" id="EN-US_TOPIC_0000001188429044__s11dbafd02fc245e8ab6884159af9fd0b"><h4 class="sectiontitle">Function</h4><p id="EN-US_TOPIC_0000001188429044__a14673df9357e4e28aaff1157cd3bde67">Modifies the definition of a full-text retrieval dictionary, including its parameters, name, owner, and schema.</p>
</div>
<div class="section" id="EN-US_TOPIC_0000001188429044__s3885984ccb904e76a8b521140774edbb"><h4 class="sectiontitle">Precautions</h4><ul id="EN-US_TOPIC_0000001188429044__ul94641895249"><li id="EN-US_TOPIC_0000001188429044__li10355217162410"><strong id="EN-US_TOPIC_0000001188429044__b411513219422">ALTER</strong> is not supported by predefined dictionaries.</li><li id="EN-US_TOPIC_0000001188429044__li10464891245">Only the owner of a dictionary can do <strong id="EN-US_TOPIC_0000001188429044__b192182611424">ALTER</strong> to the dictionary. System administrators have this permission by default.</li><li id="EN-US_TOPIC_0000001188429044__li8982216208">After a dictionary is created or modified, any modification to the user-defined dictionary definition file in the directory specified by <strong id="EN-US_TOPIC_0000001188429044__b5764174215611">FilePath</strong> will not affect the dictionary in the database. To make such modifications take effect in the dictionary in the database, run the <strong id="EN-US_TOPIC_0000001188429044__b58332587447">ALTER TEXT SEARCH DICTIONARY</strong> statement to update the definition file of the dictionary.</li></ul>
</div>
<div class="section" id="EN-US_TOPIC_0000001188429044__s097e199c371040739945504301b7678d"><h4 class="sectiontitle">Syntax</h4><ul id="EN-US_TOPIC_0000001188429044__ul10315143352818"><li id="EN-US_TOPIC_0000001188429044__li03150330288">Modify the dictionary definition.<div class="codecoloring" codetype="Sql" id="EN-US_TOPIC_0000001188429044__s49960349d09943568d3fc82d29c074fc"><div class="highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span class="normal">1</span>
<span class="normal">2</span>
<span class="normal">3</span></pre></div></td><td class="code"><div><pre><span></span><span class="k">ALTER</span><span class="w"> </span><span class="nb">TEXT</span><span class="w"> </span><span class="k">SEARCH</span><span class="w"> </span><span class="k">DICTIONARY</span><span class="w"> </span><span class="n">name</span><span class="w"> </span><span class="p">(</span>
<span class="w"> </span><span class="k">option</span><span class="w"> </span><span class="p">[</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">value</span><span class="w"> </span><span class="p">]</span><span class="w"> </span><span class="p">[,</span><span class="w"> </span><span class="p">...</span><span class="w"> </span><span class="p">]</span>
<span class="p">);</span>
</pre></div></td></tr></table></div>
</div>
</li></ul>
<ul id="EN-US_TOPIC_0000001188429044__ul17769119192715"><li id="EN-US_TOPIC_0000001188429044__li1376918912278">Rename a dictionary.<div class="codecoloring" codetype="Sql" id="EN-US_TOPIC_0000001188429044__screen18483847122817"><div class="highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span class="normal">1</span></pre></div></td><td class="code"><div><pre><span></span><span class="k">ALTER</span><span class="w"> </span><span class="nb">TEXT</span><span class="w"> </span><span class="k">SEARCH</span><span class="w"> </span><span class="k">DICTIONARY</span><span class="w"> </span><span class="n">name</span><span class="w"> </span><span class="k">RENAME</span><span class="w"> </span><span class="k">TO</span><span class="w"> </span><span class="n">new_name</span><span class="p">;</span>
</pre></div></td></tr></table></div>
</div>
</li><li id="EN-US_TOPIC_0000001188429044__li4195342272">Set the schema of a dictionary.<div class="codecoloring" codetype="Sql" id="EN-US_TOPIC_0000001188429044__screen739711222911"><div class="highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span class="normal">1</span></pre></div></td><td class="code"><div><pre><span></span><span class="k">ALTER</span><span class="w"> </span><span class="nb">TEXT</span><span class="w"> </span><span class="k">SEARCH</span><span class="w"> </span><span class="k">DICTIONARY</span><span class="w"> </span><span class="n">name</span><span class="w"> </span><span class="k">SET</span><span class="w"> </span><span class="k">SCHEMA</span><span class="w"> </span><span class="n">new_schema</span><span class="p">;</span>
</pre></div></td></tr></table></div>
</div>
</li><li id="EN-US_TOPIC_0000001188429044__li1818014540276">Change the owner of a dictionary.<div class="codecoloring" codetype="Sql" id="EN-US_TOPIC_0000001188429044__screen16146121163217"><div class="highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span class="normal">1</span></pre></div></td><td class="code"><div><pre><span></span><span class="k">ALTER</span><span class="w"> </span><span class="nb">TEXT</span><span class="w"> </span><span class="k">SEARCH</span><span class="w"> </span><span class="k">DICTIONARY</span><span class="w"> </span><span class="n">name</span><span class="w"> </span><span class="k">OWNER</span><span class="w"> </span><span class="k">TO</span><span class="w"> </span><span class="n">new_owner</span><span class="p">;</span>
</pre></div></td></tr></table></div>
</div>
</li></ul>
</div>
<div class="section" id="EN-US_TOPIC_0000001188429044__s49eade590b0f4b098e648dd1dc5e3e60"><h4 class="sectiontitle">Parameter Description</h4><ul id="EN-US_TOPIC_0000001188429044__u94351f73b3e945628b8649a4f9cc4f3e"><li id="EN-US_TOPIC_0000001188429044__l58e147705fc64066994924862c8f66e5"><em id="EN-US_TOPIC_0000001188429044__i18927213175620">name</em><p id="EN-US_TOPIC_0000001188429044__ab6d27b2b82d348be80745fa87fb975c7">Specifies the name of an existing dictionary. (If you do not specify a schema name, the dictionary in the current schema will be used.)</p>
<p id="EN-US_TOPIC_0000001188429044__a9ee2ac78101e427f90c718c3df1d1e74">Value range: name of an existing dictionary</p>
</li><li id="EN-US_TOPIC_0000001188429044__li1286812455448"><em id="EN-US_TOPIC_0000001188429044__i1418655715515">option</em><p id="EN-US_TOPIC_0000001188429044__p118691945144417">Specifies the name of a parameter to be modified. Each type of dictionaries has a template containing their custom parameters. Parameters function in a way irrelevant to their setting sequence. For details about parameters, see <a href="dws_06_0183.html#EN-US_TOPIC_0000001188270514__li1286812455448">option</a>.</p>
<div class="note" id="EN-US_TOPIC_0000001188429044__note175317431496"><img src="public_sys-resources/note_3.0-en-us.png"><span class="notetitle"> </span><div class="notebody"><ul id="EN-US_TOPIC_0000001188429044__ul1472713514498"><li id="EN-US_TOPIC_0000001188429044__li1610613580526">The <strong id="EN-US_TOPIC_0000001188429044__b1993017384220">TEMPLATE</strong> parameter in a dictionary cannot be modified.</li><li id="EN-US_TOPIC_0000001188429044__li881719523446">To specify a dictionary, specify both the dictionary definition file path (<strong id="EN-US_TOPIC_0000001188429044__b1278516181312">FILEPATH</strong>) and the file name (the parameter varies based on dictionary types).</li><li id="EN-US_TOPIC_0000001188429044__li164261957192413">The name of a dictionary definition file can contain only lowercase letters, digits, and underscores (_).</li></ul>
</div></div>
</li><li id="EN-US_TOPIC_0000001188429044__li2828134618441"><em id="EN-US_TOPIC_0000001188429044__i15859205911410">value</em><p id="EN-US_TOPIC_0000001188429044__p1282819465442">Specifies the new value of a parameter. If <strong id="EN-US_TOPIC_0000001188429044__b72307451954">=</strong> and <em id="EN-US_TOPIC_0000001188429044__i1860095212515">value</em> are omitted, the previous settings of the parameter will be deleted and the default value will be used.</p>
<p id="EN-US_TOPIC_0000001188429044__p082844644419">Value range: valid values defined for the parameter</p>
</li><li id="EN-US_TOPIC_0000001188429044__li18985947104416"><em id="EN-US_TOPIC_0000001188429044__i17571818810">new_name</em><p id="EN-US_TOPIC_0000001188429044__p4986347144410">Specifies the new name of a dictionary.</p>
<p id="EN-US_TOPIC_0000001188429044__p7986447104414">Value range: a string, which complies with the identifier naming convention. A value can contain a maximum of 63 characters.</p>
</li><li id="EN-US_TOPIC_0000001188429044__li17901848124419"><em id="EN-US_TOPIC_0000001188429044__i214024342619">new_owner</em><p id="EN-US_TOPIC_0000001188429044__p1790174824414">Specifies the new owner of a dictionary.</p>
<p id="EN-US_TOPIC_0000001188429044__p1679004804418">Value range: an existing user name</p>
</li><li id="EN-US_TOPIC_0000001188429044__li93661047174313"><em id="EN-US_TOPIC_0000001188429044__i2938114572716">new_schema</em><p id="EN-US_TOPIC_0000001188429044__p43482361404">Specifies the new schema of a dictionary.</p>
<p id="EN-US_TOPIC_0000001188429044__p534813362019">Value range: an existing schema name</p>
</li></ul>
</div>
<div class="section" id="EN-US_TOPIC_0000001188429044__s974b31b9463848259512367e2d285b74"><h4 class="sectiontitle">Examples</h4><pre class="screen" id="EN-US_TOPIC_0000001188429044__screen925825682017">CREATE TEXT SEARCH DICTIONARY my_dict (
TEMPLATE = snowball,
Language = english,
StopWords = english
);</pre>
<p id="EN-US_TOPIC_0000001188429044__p9529954175020">Modify the definition of stop words in <strong id="EN-US_TOPIC_0000001188429044__b136311736333435">Snowball</strong> dictionaries. Retain the values of other parameters.</p>
<div class="notice" id="EN-US_TOPIC_0000001188429044__note8911201315239"><span class="noticetitle"><img src="public_sys-resources/notice_3.0-en-us.png"> </span><div class="noticebody"><p id="EN-US_TOPIC_0000001188429044__p13912121322315">Hard-coded or plaintext AK and SK are risky. For security purposes, encrypt your AK and SK and store them in the configuration file or environment variables.</p>
</div></div>
<div class="codecoloring" codetype="Sql" id="EN-US_TOPIC_0000001188429044__screen1152955485016"><div class="highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span class="normal">1</span></pre></div></td><td class="code"><div><pre><span></span><span class="k">ALTER</span><span class="w"> </span><span class="nb">TEXT</span><span class="w"> </span><span class="k">SEARCH</span><span class="w"> </span><span class="k">DICTIONARY</span><span class="w"> </span><span class="n">my_dict</span><span class="w"> </span><span class="p">(</span><span class="w"> </span><span class="n">StopWords</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">newrussian</span><span class="p">,</span><span class="w"> </span><span class="n">FilePath</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s1">'obs://bucket_name/path accesskey=ak secretkey=sk region=rg'</span><span class="w"> </span><span class="p">);</span>
</pre></div></td></tr></table></div>
</div>
<p id="EN-US_TOPIC_0000001188429044__p14530165419509">Modify the <strong id="EN-US_TOPIC_0000001188429044__b191346135233435">Language</strong> parameter in <strong id="EN-US_TOPIC_0000001188429044__b168879471933435">Snowball</strong> dictionaries and delete the definition of stop words.</p>
<div class="codecoloring" codetype="Sql" id="EN-US_TOPIC_0000001188429044__screen1753085495020"><div class="highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span class="normal">1</span></pre></div></td><td class="code"><div><pre><span></span><span class="k">ALTER</span><span class="w"> </span><span class="nb">TEXT</span><span class="w"> </span><span class="k">SEARCH</span><span class="w"> </span><span class="k">DICTIONARY</span><span class="w"> </span><span class="n">my_dict</span><span class="w"> </span><span class="p">(</span><span class="w"> </span><span class="k">Language</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">dutch</span><span class="p">,</span><span class="w"> </span><span class="n">StopWords</span><span class="w"> </span><span class="p">);</span>
</pre></div></td></tr></table></div>
</div>
<p id="EN-US_TOPIC_0000001188429044__p0530354125011">Update the dictionary definition and do not change any other content.</p>
<div class="codecoloring" codetype="Sql" id="EN-US_TOPIC_0000001188429044__screen15530854195020"><div class="highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span class="normal">1</span></pre></div></td><td class="code"><div><pre><span></span><span class="k">ALTER</span><span class="w"> </span><span class="nb">TEXT</span><span class="w"> </span><span class="k">SEARCH</span><span class="w"> </span><span class="k">DICTIONARY</span><span class="w"> </span><span class="n">my_dict</span><span class="w"> </span><span class="p">(</span><span class="w"> </span><span class="n">dummy</span><span class="w"> </span><span class="p">);</span>
</pre></div></td></tr></table></div>
</div>
</div>
<div class="section" id="EN-US_TOPIC_0000001188429044__s56e26682f0c24a8987ba07e3099ff0a9"><h4 class="sectiontitle">Helpful Links</h4><p id="EN-US_TOPIC_0000001188429044__p63691819155"><a href="dws_06_0183.html">CREATE TEXT SEARCH DICTIONARY</a>, <a href="dws_06_0211.html">DROP TEXT SEARCH DICTIONARY</a></p>
</div>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="dws_06_0118.html">DDL Syntax</a></div>
</div>
</div>