简体   繁体   English

如何在不区分大小写的情况下读取 cassandra 数据

[英]How to read cassandra data with out case sensitive

I need to get the data from cassandra with out case sensitive.我需要从 cassandra 获取不区分大小写的数据。 Please help me.请帮帮我。

There is no case-sensitivity concept in Cassandra. Cassandra 中没有区分大小写的概念。 All the data is stored as byte[] , so it's not even a String.所有数据都存储为byte[] ,因此它甚至不是字符串。

You can make a custom comparator ( see the API ) which transforms byte[] to String and disregards case.您可以制作一个自定义比较器(请参阅 API ),它将byte[]转换为 String 并忽略大小写。

The other thing to do is just get the data and transform it on the client side.要做的另一件事就是获取数据并在客户端对其进行转换。

Actually, your question is quite unclear as of what is your goal, so I can't give more details.实际上,你的问题很不清楚你的目标是什么,所以我不能提供更多细节。

Update: Run a one-time job that fetches all records from the db and updates them, setting to lower-case.更新:运行一次性作业,从数据库中获取所有记录并更新它们,设置为小写。 Then continue inserting everything with lowercase.然后继续用小写插入所有内容。

This has been resolved if you have SOLR enabled using: CREATE SEARCH INDEX ON tableName WITH COLUMNS *, camelCaseColumn { lowerCase : true };如果您使用以下方法启用了 SOLR,则此问题已得到解决: CREATE SEARCH INDEX ON tableName WITH COLUMNS *, camelCaseColumn { lowerCase : true };

An index is created that allows the select statement to use lowercase in the where clause.创建的索引允许 select 语句在 where 子句中使用小写。 For more details search for LowerCaseStrField.有关更多详细信息,请搜索 LowerCaseStrField。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM