Cassandra CQL通配符搜索 [英] Cassandra CQL wildcard search

查看:804
本文介绍了Cassandra CQL通配符搜索的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个表结构,像



创建表文件(id文本主键,fname文本,mimetype文本,isdir布尔值,位置文本)

在文件(位置)上创建索引文件位置;



,以下是表中的内容:



插入文件(id,fname,mimetype,isdir,location)值('1','f1','pdf',False,'c:/ test /') ;

insert into file(id,fname,mimetype,isdir,location)values('2','f2','pdf',False,'c:/ test /');

insert into file(id,fname,mimetype,isdir,location)values('3','f3','pdf',False,'c:/ test /');

insert into file(id,fname,mimetype,isdir,location)values('4','f4','pdf',False,'c:/ test / a /');
b
$ b

我想列出符合以下条件的所有ID:



从文件中选择id, / test /%';



我知道CQL不支持like,任何人都可以建议我对这种通配符搜索查询。请建议。

解决方案

DataStax Enterprise向Cassandra添加全文搜索: http://www.datastax.com/docs/datastax_enterprise3.1/solutions/search_index


I have a table structure like

create table file(id text primary key, fname text, mimetype text, isdir boolean, location text);
create index file_location on file (location);

and following is the content in the table:

insert into file (id, fname, mimetype, isdir, location) values('1', 'f1', 'pdf', False, 'c:/test/');
insert into file (id, fname, mimetype, isdir, location) values('2', 'f2', 'pdf', False, 'c:/test/');
insert into file (id, fname, mimetype, isdir, location) values('3', 'f3', 'pdf', False, 'c:/test/');
insert into file (id, fname, mimetype, isdir, location) values('4', 'f4', 'pdf', False, 'c:/test/a/');

I want to list out all the ids matching the following criteria:

select id from file where location like '%/test/%';

I know that like is not supported in CQL, can anyone please suggest the approach should I take for these kind of wildcard search queries. Please suggest.

解决方案

DataStax Enterprise adds full text search to Cassandra: http://www.datastax.com/docs/datastax_enterprise3.1/solutions/search_index

这篇关于Cassandra CQL通配符搜索的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆