cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Pavel Yaskevich (JIRA)" <>
Subject [jira] [Commented] (CASSANDRA-11131) [SASI Pre-QA] Allow '<term>%' syntax for CONTAINS mode
Date Mon, 08 Feb 2016 05:28:39 GMT


Pavel Yaskevich commented on CASSANDRA-11131:

LIKE '<term>%' is a PREFIX mode construct which, as you mentioned, for CONTAINS is the
same as LIKE '%<term>%' that's why these two are not intermixed together as it pretty
hard to maintain in presence of pluggable analyzers.

> [SASI Pre-QA] Allow '<term>%' syntax for CONTAINS mode
> ------------------------------------------------------
>                 Key: CASSANDRA-11131
>                 URL:
>             Project: Cassandra
>          Issue Type: Improvement
>          Components: CQL
>         Environment: Tested from build [CASSANDRA-11067|]
>            Reporter: DOAN DuyHai
>            Assignee: Pavel Yaskevich
> Tested from build [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(2, 'Hilary Duff', 'So Yesterday');
> INSERT INTO music.albums(id, artist, title) VALUES(3, 'The Mr. T Experience', 'Yesterday
> 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

View raw message