Bringing together the Apache Cassandra experts from the community and DataStax.

Want to learn? Have a question? Want to share your expertise? You are in the right place!

Not sure where to begin? Getting Started

 

question

amit.himani avatar image
amit.himani asked Erick Ramirez edited

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

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

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