You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by "DOAN DuyHai (JIRA)" <ji...@apache.org> on 2016/02/07 13:47:39 UTC

[jira] [Created] (CASSANDRA-11131) [SASI Pre-QA] Allow '%' syntax for CONTAINS mode

DOAN DuyHai created CASSANDRA-11131:
---------------------------------------

             Summary: [SASI Pre-QA] Allow '<term>%' syntax for CONTAINS mode
                 Key: CASSANDRA-11131
                 URL: https://issues.apache.org/jira/browse/CASSANDRA-11131
             Project: Cassandra
          Issue Type: Improvement
          Components: CQL
            Reporter: DOAN DuyHai


Tested from build [CASSANDRA-11067|https://issues.apache.org/jira/browse/CASSANDRA-11067]

{code:sql}
CREATE KEYSPACE music WITH replication = {'class': 'SimpleStrategy', 'replication_factor': '1'}  AND durable_writes = true;

CREATE TABLE music.albums (
    id int PRIMARY KEY,
    artist text,
    title text
);

CREATE CUSTOM INDEX ON music.albums (title) USING 'org.apache.cassandra.index.sasi.SASIIndex' WITH OPTIONS = {'tokenization_skip_stop_words': 'true', 'analyzer_class': 'org.apache.cassandra.index.sasi.analyzer.StandardAnalyzer', 'case_sensitive': 'false', 'mode': 'CONTAINS', 'tokenization_enable_stemming': 'true'};

INSERT INTO music.albums(id, artist, title) VALUES(1, 'Superpitcher', 'Yesterday');
INSERT INTO music.albums(id, artist, title) VALUES(1, 'Hilary Duff', 'So Yesterday');
INSERT INTO music.albums(id, artist, title) VALUES(1, 'The Mr. T Experience', 'Yesterday Rules');

SELECT artist,title FROM music.albums WHERE title LIKE 'Yesterday%';

InvalidRequest: code=2200 [Invalid query] message="title3 LIKE '<term>%' restriction is only supported on properly indexed columns"

{code}

It seems that for *CONTAINS* mode, only _%<term>%_ and _%<term>_ syntaxes are allowed. 

Is there any technical reason to ban _<term>%_ syntax ? 

Indeed using _%<term>%_ would return all results matched by _<term>%_



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)