2017-05-18 21 views
1

CQLの文字列に部分文字列を見つけることはできますか? exempleについては 、このようなクエリますクエリCQLのサブ文字列

select id from table where string contains 'do' は事前

答えて

1

にありがとうはい、これはストレージ添付指数(SASI)の使用で可能です。クエリは次のようになります:

SELECT * FROM table WHERE colname LIKE 'do%'; 

使用方法はofficial documentationです。

+0

ハムそれは私が欲しいものですが、動作しません。この 'create table test(id int、string text、主キー(id));'を作成します。次に、私はこのクエリを実行した後、文字列のインデックスを作成しました。 'select * from test where where like string 'と'; 'と私は答えがありません。私はlike節で既に%で試してみましたが、問題はすでにここにあります。 –

+0

@AlexandreS。インデックス定義とクエリを表示してください。 – xmas79

+0

私のインデックスがあります: 'テスト(文字列)USING 'でカスタムインデックステストを作成する' org.apache.cassandra.index.sasi.SASIIndex 'WITH OPTIONS = {' mode ':' CONTAINS '、' analyzer_class ':' org.apache 'true'、 'tokenization_skip_stop_words': 'and'、 'or'、 'tokenization_enable_stemming': 'true'、 'tokenization_normalize_lowercase': 'true'、 'tokenization_locale' ':' en '}; '。そして、私のクエリは: 'select * from test where where like 'and' ' –