3
votes

I have a custom index created by solr on cassandra table

CREATE CUSTOM INDEX custom_index ON table_name (column) USING 'com.datastax.bdp.search.solr.Cql3SolrSecondaryIndex';

As far as i know, in the select clause of cassandra we can only have primary key in the where clause for select query.

Can I use this custom index in the where clause?

2

2 Answers

3
votes

In order to run CQL queries based on your lucene-solr indexes, you have to install DataStax Enterprise 4.6 and use the "solr_query" special column, as described here: http://www.datastax.com/documentation/datastax_enterprise/4.6/datastax_enterprise/srch/srchCql.html

1
votes

Yes you can. You can use in where clause partition keys and indexes. But if you want to use indexed columns without partition key, you have to specify ALLOW FILTERING (see exemple below)

SELECT * FROM <myColumnFamilly> WHERE <column> > 100 ALLOW FILTERING;

Of course in this exemple must be a number type.