我的日期时间列仅用于排序目的,其余的集群键用于过滤。但是我无法在不为日期时间提供等效值的情况下按其他列进行过滤。如果我使用Apache solr,我可以解决我的问题吗?
我的桌子:
create table search_by_company_id_status
(
agency_id text,
datetime timestamp,
createid text,
status text,
primary key ((agency_id),datetime,status,createid)) with clustering order by (datetime desc);
查询我正在尝试:
select * from search_by_agency_id_status where agency_id='125' and datetime>'2018-02-02 12:00:00.000' and recordstatus='7' and createid='id234';
根据您提供的查询,您将在其余的聚类分析列(即"状态"和"createdid"(上使用"等于"谓词进行过滤。
您可以按如下方式重新设计表,以保证日期时间的排序顺序(因为每个先前的值都针对单个值进行筛选(。
create table search_by_company_id_status
(
agency_id text,
datetime timestamp,
createid text,
status text,
primary key ((agency_id),status,createid,datetime)) with clustering order by (datetime desc);
此查询应该可以正常工作
select * from search_by_agency_id_status where agency_id='125' and status='7' and createid='id234' and datetime>'2018-02-02 12:00:00.000';