Wildcard search in cassandra database

11,126

There is no native way to perform such queries in Cassandra. Typical options to achieve the same are

a) Maintain an index yourself on likely search terms. For example, whenever you are inserting an entry which has hello in the username, insert an entry in the index column family with hello as the key and the column value as the key of your data entry. While querying, query the index CF and then fetch data from your data CF. Of course, this is pretty restrictive in nature but can be useful for some basic needs.

b) A better bet is to use a full text search engine. Take a look at Solandra, https://github.com/tjake/Solandra or Datastax enterprise http://www.datastax.com/products/enterprise

Share:
11,126
Admin
Author by

Admin

Updated on July 03, 2022

Comments

  • Admin
    Admin almost 2 years

    I want to know if there is any way to perform wildcard searches in cassandra database. e.g.

    select KEY,username,password from User where username='\*hello*';
    

    Or

    select KEY,username,password from User where username='%hello%';
    

    something like this.