Click here to view and discuss this page in DocCommentXchange. In the future, you will be sent there automatically.

SQL Anywhere 11.0.1 (日本語) » SQL Anywhere サーバ - SQL の使用法 » データのクエリと変更 » データのクエリ » テキスト設定オブジェクト

 

テキスト設定オブジェクトの例

テキスト設定オブジェクトの設定、およびそれがテキスト・インデックスの内容やテキスト・インデックスへの問い合わせ結果にどのような影響を与えるかに関する詳細については、テキスト設定オブジェクトの設定を参照してください。

データベースのすべてのテキスト設定オブジェクト、およびその設定に関するリストについては、SYSTEXTCONFIG システム・ビューを問い合わせてください (例:SELECT * FROM SYSTEXTCONFIG)。SYSTEXTCONFIG システム・ビューを参照してください。

デフォルトのテキスト設定オブジェクト

SQL Anywhere には、NCHAR データに使用する 「default_nchar」 と非 NCHAR データに使用する 「default_char」 というデフォルトのテキスト設定オブジェクトが 2 つあります。これらの設定は、テキスト設定オブジェクトやテキスト・インデックスを初めて作成する際に作成されます。誤って 1 つを削除してしまった場合は、テキスト設定オブジェクトやテキスト・インデックスを次回作成する際に再作成されます。

インストール時における default_char と default_nchar の設定を以下の表に示します。これらの設定は、ほとんどの文字ベースの言語で最適であるという理由で選択されています。デフォルトのテキスト設定オブジェクトの設定を変更しないことを強くおすすめします。

設定 インストールされる値
TERM BREAKER

0 (GENERIC)

MINIMUM TERM LENGTH 1
MAXIMUM TERM LENGTH 20
STOPLIST (空)

デフォルトのテキスト設定オブジェクトを削除すると、テキスト・インデックスやテキスト設定オブジェクトを次回作成する際に自動的に作成されます。DROP TEXT CONFIGURATION 文を参照してください。

テキスト設定オブジェクトの例

次の表は、さまざまなテキスト設定オブジェクトの設定、インデックス付けされる対象に与える影響、および全文クエリ文字列の解釈方法を示したものです。すべての例で、文字列 'I'm not sure I understand' を使用しています。

設定 インデックス付けされる単語 クエリ解釈

TERM BREAKER GENERIC

MINIMUM TERM LENGTH 1

MAXIMUM TERM LENGTH 20

STOPLIST ''

I m not sure I understand

"I m" AND not AND sure AND I AND understand'

TERM BREAKER GENERIC

MINIMUM TERM LENGTH 2

MAXIMUM TERM LENGTH 20

STOPLIST 'not and'

sure understand

'sure AND understand'.

TERM BREAKER NGRAM

MAXIMUM TERM LENGTH 3

STOPLIST 'not and'

sur ure und nde der ers rst sta tan

'sur AND ure AND und AND nde AND der AND ers AND rst AND sta AND tan'.

あいまい検索の場合:

'sur OR ure OR und OR nde OR der OR ers OR rst OR sta OR tan'

TERM BREAKER GENERIC

MINIMUM TERM LENGTH 1

MAXIMUM TERM LENGTH 20

STOPLIST 'not and'

I m sure I understand

'"I m" AND sure AND I AND understand'.

TERM BREAKER NGRAM

MAXIMUM TERM LENGTH 20

STOPLIST 'not and'

20 文字以上の単語がないため、インデックス付けされるものはありません。

これは、MAXIMUM TERM LENGTH の GENERIC テキスト・インデックスへの影響と NGRAM テキスト・インデックスへの影響が異なることを示しています。NGRAM テキスト・インデックスの場合、MAXIMUM TERM LENGTH は、テキスト・インデックスに挿入される N-gram の長さを設定します。

クエリ文字列から 20 文字の N-gram を構成できないため、検索を実行すると空の結果セットが返されます。

文字列解釈の例

次の表は、テキスト設定オブジェクトの文字列の設定がどのように解釈されるかについて、例を示したものです。

解釈される文字列の列にあるカッコ内の数字は、各単語の位置情報を表しています。この数字は、説明の目的でマニュアルに記載されています。格納される実際の単語にはカッコ内の数字は含まれません。

設定 文字列 解釈される文字列

TERM BREAKER GENERIC

MINIMUM TERM LENGTH 3

MAXIMUM TERM LENGTH 20

'w*'

'"w*(1)"'

'we*'

'"we*(1)"'

'wea*'

'"wea*(1)"'

'we* -the'

'"we*(1)" -"the(1)"'

'we* the'

"we*(1)" & "the(1)"'

'for* | wonderl*'

'"for*(1)" | "wonderl*(1)"'

'wonderlandwonderlandwonderland*'

''

'"tr* weather"'

'"weather(1)"'

'"tr* the weather"'

'"the(1) weather(2)"'

'"wonderlandwonderlandwonderland* wonderland"'

'"wonderland(1)"'

'"wonderlandwonderlandwonderland* weather"'

'"weather(1)"'

'"the_wonderlandwonderlandwonderland* weather"'

'"the(1) weather(3)"'

'the_wonderlandwonderlandwonderland* weather'

'"the(1)" & "weather(1)"'

'"light_a* the end" & tunnel'

'"light(1) the(3) end(4)" & "tunnel(1)"'

light_b* the end" & tunnel'

'"light(1) the(3) end(4)" & "tunnel(1)"'

'"light_at_b* end"'

'"light(1) end(4)"'

'and-te*'

'"and(1) te*(2)"'

'a_long_and_t* & journey'

'"long(2) and(3) t*(4)" & "journey(1)"'

TERM BREAKER NGRAM

MAXIMUM TERM LENGTH 3

'w*'

'"w*(1)"'

'we*'

'"we*(1)"'

'wea*

'"wea(1)"'

'we* -the'

'"we*(1)" -"the(1)"'

'we* the'

'"we*(1)" & "the(1)"'

'for | la*'

'"for(1)" | "la*(1)"'

'weath*'

'"wea(1) eat(2) ath(3)"'

'"ful weat*"'

'"ful(1) wea(2) eat(3)"'

'"wo* la*"'

'"wo*(1)" & "la*(2)"'

'"la* won* "'

'"la*(1)" & "won(2)"'

'"won* weat*"'

'"won(1)" & "wea(2) eat(3)"'

'"won* weat"'

'"won(1)" & "wea(2) eat(3)"'

'"wo* weat*"'

'"wo*(1)" & "wea(2) eat(3)"'

'"weat* wo* "'

'"wea(1) eat(2)" & "wo*(3)"'

'"wo* weat"'

'"wo*(1)" & "wea(2) eat(3)"'

'"weat wo* "'

'"wea(1) eat(2) wo*(3)"'

'w* NEAR[1] f*'

'"w*(1)" & "f*(1)"'

'weat* NEAR[1] f*'

"wea(1) eat(2)" & "f*(1)"'

'f* NEAR[1] weat*'

'"f*(1)" & "wea(1) eat(2)"'

'weat NEAR[1] f*'

'"wea(1) eat(2)" & "f*(1)"'

'f* NEAR[1] weat'

'"f*(1)" & "wea(1) eat(2)"'

'for NEAR[1] weat*'

'"for(1)" & "wea(1) eat(2)"'

'weat* NEAR[1] for'

'"wea(1) eat(2)" & "for(1)"'

'and_tedi*'

'"and(1) ted(2) edi(3)"'

'and-t*'

'"and(1) t*(2)"'

'"and_tedi*"'

'"and(1) ted(2) edi(3)"'

'"and-t*"'

'"and(1) t*(2)"'

'"ligh* at_the_end of_the tun* nel"'

'"lig(1) igh(2)" & ("the(4) end(5) the(7) tun(8)" & "nel(9)")'

'"ligh* at_the_end_of_the_tun* nel"'

'"lig(1) igh(2)" & ("the(4) end(5) the(7) tun(8)" & "nel(9)")'

'"at_the_end of_the tun* ligh* nel"'

'"the(2) end(3) the(5) tun(6)" & ("lig(7) igh(8)" & "nel(9)")'

'l* NEAR[1] and_t*'

"l*(1)" & "and(1) t*(2)"'

'long NEAR[1] and_t*'

'"lon(1) ong(2)" & "and(1) t*(2)"'

'end NEAR[3] tunne*'

'"end(1)" & "tun(1) unn(2) nne(3)"'

TERM BREAKER NGRAM

MAXIMUM TERM LENGTH 3

SKIPPED TOKENS IN TABLE AND IN QUERIES

'"cat in a hat"'

'"cat(1) hat(4)"'

'"cat in_a hat"'

'"cat(1) hat(4)"'

'"cat_in_a_hat"'

'"cat(1) hat(4)"'

'"cat_in a_hat"'

'"cat(1) hat(4)"'

'cat in a hat'

'"cat(1)" & "hat(1)"'

'cat in_a hat'

'"cat(1)" & "hat(1)"'

'"ice hat"'

'"ice(1) hat(2)"'

'ice NEAR[1] hat'

'"ice(1)" NEAR[1] "hat(1)"'

'ear NEAR[2] hat'

'"ear(1)" NEAR[2] "hat(1)"'

'"ear a hat"'

'"ear(1) hat(3)"'

'"cat hat"'

'"cat(1) hat(2)"'

'cat NEAR[1] hat'

'"cat(1)" NEAR[1] "hat(1)"'

'ear NEAR[1] hat'

'"ear(1)" NEAR[1] "hat(1)"'

'"ear hat"'

'"ear(1) hat(2)"'

'"wear a a hat"'

'"wea(1) ear(2) hat(5)"'

参照