我想知道是否有任何方法可以在 cassandra 数据库中执行通配符搜索。 例如
select KEY,username,password from User where username='\*hello*';
或者
select KEY,username,password from User where username='%hello%';
像这样。
最佳答案
在 Cassandra 中没有执行此类查询的本地方法。实现相同目标的典型选项是
a) 自己维护可能搜索词的索引。例如,每当您插入一个在用户名中有 hello 的条目时,在索引列族中插入一个条目,以 hello 作为键,列值作为数据条目的键。查询时,查询索引CF,然后从你的数据CF中获取数据。当然,这在本质上是非常有限的,但对于某些基本需求可能很有用。
b) 更好的选择是使用全文搜索引擎。看看 Solandra,https://github.com/tjake/Solandra或 Datastax 企业 http://www.datastax.com/products/enterprise
关于database - cassandra 数据库中的通配符搜索,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11681522/