PLANNED MAINTENANCE

Hello, DataStax Community!

We want to make you aware of a few operational updates which will be carried out on the site. We are working hard to streamline the login process to integrate with other DataStax resources. As such, you will soon be prompted to update your password. Please note that your username will remain the same.

As we work to improve your user experience, please be aware that login to the DataStax Community will be unavailable for a few hours on:

  • Wednesday, July 15 16:00 PDT | 19:00 EDT | 20:00 BRT
  • Thursday, July 16 00:00 BST | 01:00 CEST | 04:30 IST | 07:00 CST | 09:00 AEST

For more info, check out the FAQ page. Thank you for being a valued member of our community.


question

amit.himani avatar image
amit.himani asked ·

Is it possible to do a case-insensitive query of column in CQL?

Hi,

I have created table using below SQL: I want to run query to find all video by actor name (case insensitive)

CREATE TABLE video_by_actor(
    actor text,
    added_date timestamp,
    video_id timeuuid ,
    character_name text,
    description text ,
    encoding frozen<video_encoding>,
    tags set<text>,
    title text,
    user_id uuid,
    primary key ((actor), added_date)
) with clustering order by (added_date desc);
select * from video_by_actor where actor='Tom Hanks'

// I want to search all case eg. tom hanks, Tom hanks, tom Hanks etc.

Is it possible?

cassandra
10 |1000 characters needed characters left characters exceeded

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

1 Answer

alexandre.dutra avatar image
alexandre.dutra answered ·

This is not possible with regular CQL queries, but you have a few options:

  1. Create a special column in your table to store the normalized string that you want to search.
  2. Use a SASI index.
  3. Use DSE Search.
Share
10 |1000 characters needed characters left characters exceeded

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.