7 database search wildcard cassandra
我想知道是否有任何方法可以在cassandra数据库中执行通配符搜索.例如
select KEY,username,password from User where username='\*hello*';
Run Code Online (Sandbox Code Playgroud)
要么
select KEY,username,password from User where username='%hello%';
Run Code Online (Sandbox Code Playgroud)
这样的事情.
Moh*_*it 4
Cassandra 中没有执行此类查询的本机方法。实现相同目标的典型选项是
a) 自行维护可能的搜索词的索引。例如,每当您插入用户名中包含 hello 的条目时,请在索引列族中插入一个条目,其中 hello 作为键,列值作为数据条目的键。查询时,查询索引CF,然后从你的数据CF中取出数据。当然,这本质上是相当有限制的,但对于一些基本需求来说可能很有用。
b) 更好的选择是使用全文搜索引擎。查看 Solandra、https://github.com/tjake/Solandra或 Datastax enterprise http://www.datastax.com/products/enterprise