question

Smartron avatar image
Smartron asked Erick Ramirez answered

What's a suitable query pattern for populating a drop down list from a table as the data is entered?

Thus, or as the say in The Valley... So, if the actor enters "p" all the entries in the table starting with "p" are returned. Then the next letter is entered, say "pr", now all the entries in the table starting with "pr" are returned. What is the best way to populate drop down lists?

cql
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

Erick Ramirez avatar image
Erick Ramirez answered

It isn't possible to filter queries with the equivalent of SQL's LIKE operator in CQL. So you couldn't read from a table with a query that looks like this:

SELECT ... FROM table WHERE pk LIKE 'p%'

You will probably need a text search functionality like Apache Solr to achieve this. Solr can do free-form searches with the LIKE clause on a column that is indexed with Apache Lucene.

You can integrate Solr/Lucene with Cassandra yourself. But if you're looking for an out-of-the-box solution, DataStax Enterprise includes DSE Search which allows you to perform complex text searches backed by Solr and Lucene. Cheers!

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.