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



rkagan_146583 avatar image
rkagan_146583 asked Erick Ramirez edited

Reducing number of long running queries by changing data model.


I wonder how should we create our table to contain multiple stores per row in order to index that/those field(s) to retrieve data from Solr by issuing cql faster?

This is the query we have:

select upc, division, description, store_level_filters, deleted from item_ent_divs where solr_query = '{"q":"{!edismax boost=\"if(exists(query({!edismax qf=upc_search v=\\\"none\\\"})),300,add(def(synthetic_boost,0),div(1,sum(1,pow(e(),product(-0.00003,sub(min(200000,popularity),100000)))))))\
qf=\"description_search^5 brand_search taxonomy_search^0.5 keywords_search^0.5 semantic_boost_search^100 upc_search^100\
}((milk) OR \"milk\"^25 OR (milk) OR \"milk\"^5)
"fq":"(+division:(14) (+store_level_filters_terms:(383-a*) OR +store_level_filters_terms:(383-?c*) OR +store_level_filters_terms:(383-??d*)))"}';

store_level_filters_terms field is a string field that contain the store number then hyphen then modalities like "available in store", "available to pick up", "available to deliver" that marked by "a.." or ".c." or "..d" letters in different positions. Each division might have up to 50 stores and each store might have different letter combinations (1 to 1 although, e.g. store 383 might have all "acd" and store 85 ="xcd"). I wonder how can we redo our schema to make store field and modality as indexed fields without repeating the same row except the store-modality one?

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

Lewisr650 avatar image
Lewisr650 answered

We would need to understand what your current schema definition is in Cassandra as well as Solrconfig.xml to answer this question.

10 |1000

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