[ 
https://issues.apache.org/jira/browse/CASSANDRA-20808?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18053450#comment-18053450
 ] 

Caleb Rackliffe edited comment on CASSANDRA-20808 at 1/22/26 5:58 AM:
----------------------------------------------------------------------

OR is not actually supported for SAI queries (or CQL even at the syntax level). 
It's something that could be done though, and the DataStax fork actually has an 
implementation that could be ported without too much pain I imagine: 
https://github.com/datastax/cassandra/pull/206


was (Author: maedhroz):
OR is not actually supported for SAI queries (or CQL even at the syntax level). 
It's something that could be done though, and the DataStax fork actually has an 
implementation that could be ported without too much pain I imagine: 
https://github.com/datastax/cassandra/commit/0a7cb8aee34a61c1b75def1b7ba46be9a3703e8f

> OR is not working on SAI indexes
> --------------------------------
>
>                 Key: CASSANDRA-20808
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-20808
>             Project: Apache Cassandra
>          Issue Type: Bug
>            Reporter: Andrew Grosser
>            Assignee: Sunil Ramchandra Pawar
>            Priority: Normal
>
> For 5.0.4 (current) release. It seems the sai indexes are off?
>  
> Example:
> ```
> cqlsh:sfpla> create index on test(y) using 'sai';
> cqlsh:sfpla> create table test(x timeuuid primary key);
> cqlsh:sfpla> select * from test where y=982c4900-3256-11ef-9772-1e1480865e16 
> or y=982c4900-3256-11ef-9772-1e1480865e16;
> SyntaxException: line 1:64 no viable alternative at input 'or' (...from test 
> where y=982c4900-3256-11ef-9772-1e1480865e16 [or]...)
> ```
>  
> Docs report his is possible:
> https://cassandra.apache.org/doc/latest/cassandra/developing/cql/indexing/sai/sai-query.html
> ```
> This example uses the following table and indexes:
>  {{CREATE TABLE IF NOT EXISTS cycling.comments_vs (
>   record_id timeuuid,  id uuid,
>   commenter text,  comment text,
>   comment_vector VECTOR <FLOAT, 5>,
>   created_at timestamp,
>   PRIMARY KEY (id, created_at)
> )WITH CLUSTERING ORDER BY (created_at DESC);CREATE INDEX commenter_idx    ON 
> cycling.comments_vs (commenter)    USING 'sai';CREATE INDEX created_at_idx    
> ON cycling.comments_vs (created_at)    USING 'sai';CREATE INDEX ann_index    
> ON cycling.comments_vs (comment_vector)    USING 'sai';}}
> Several indexes are created for the table to demonstrate how to query for 
> matches on more than one column.
> Query for a match on either one column or the other:
>  * Query
>  * Result
>  {{SELECT * FROM cycling.comments_vs
>     WHERE
>     created_at='2017-03-21 21:11:09.999000+0000'
>     OR created_at='2017-03-22 01:16:59.001000+0000';}}
> {{```}}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to