[jira] [Commented] (CASSANDRA-11389) Case sensitive in LIKE query althogh index created with false
[ https://issues.apache.org/jira/browse/CASSANDRA-11389?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15222348#comment-15222348 ] DOAN DuyHai commented on CASSANDRA-11389: - I faced more or less the same issue I created an index with {{options =\{ 'mode' : 'PREFIX', 'case_sensitive' : 'false' \}}} and of course case insensitivity was not taken into acount. I dropped and re-created the index by adding an analyzer class (NonTokenizer) and it worked > Case sensitive in LIKE query althogh index created with false > - > > Key: CASSANDRA-11389 > URL: https://issues.apache.org/jira/browse/CASSANDRA-11389 > Project: Cassandra > Issue Type: Improvement > Components: sasi >Reporter: Alon Levi >Priority: Minor > Labels: sasi > Fix For: 3.x > > > I created an index on user's first name as following: > CREATE CUSTOM INDEX ON users (first_name) USING > 'org.apache.cassandra.index.sasi.SASIIndex' > with options = { > 'mode' : 'CONTAINS', > 'case_sensitive' : 'false' > }; > This is the data I have in my table > user_id | first_name > | last_name > ---+---+--- > daa312ae-ecdf-4eb4-b6e9-206e33e5ca24 | Shlomo | Cohen > ab38ce9d-2823-4e6a-994f-7783953baef1 | Elad | Karakuli > 5e8371a7-3ed9-479f-9e4b-e4a07c750b12 | Alon | Levi > ae85cdc0-5eb7-4f08-8e42-2abd89e327ed | Gil | Elias > Although i mentioned the option 'case_sensitive' : 'false' > when I run this query : > select user_id, first_name from users where first_name LIKE '%shl%'; > The query returns no results. > However, when I run this query : > select user_id, first_name from users where first_name LIKE '%Shl%'; > The query returns the right results, > and the strangest thing is when I run this query: > select user_id, first_name from users where first_name LIKE 'shl%'; > suddenly the query is no more case sensitive and the results are fine. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (CASSANDRA-11389) Case sensitive in LIKE query althogh index created with false
[ https://issues.apache.org/jira/browse/CASSANDRA-11389?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15217678#comment-15217678 ] Pavel Yaskevich commented on CASSANDRA-11389: - Sorry, it's actually both not either and LIKE 'shl%' (which is prefix query) is not currently allowed with CONTAINS index. {noformat} Connected to Test Cluster at 127.0.0.1:9042. [cqlsh 5.0.1 | Cassandra 3.6-SNAPSHOT | CQL spec 3.4.0 | Native protocol v4] Use HELP for help. cqlsh> create KEYSPACE test WITH replication = {'class': 'SimpleStrategy', 'replication_factor': 1}; cqlsh> use test; cqlsh:test> help create_table; cqlsh:test> create table users (user_id uuid PRIMARY KEY, first_name text, last_name text); cqlsh:test> CREATE CUSTOM INDEX ON users (first_name) USING 'org.apache.cassandra.index.sasi.SASIIndex' ... with options = { 'mode': 'CONTAINS', 'analyzed': 'true', 'analyzer_class': 'org.apache.cassandra.index.sasi.analyzer.NonTokenizingAnalyzer', 'case_sensitive' : 'false' }; cqlsh:test> help INSERT; cqlsh:test> INSERT INTO users (user_id, first_name, last_name) VALUES (daa312ae-ecdf-4eb4-b6e9-206e33e5ca24, 'Shlomo', 'Cohen'); cqlsh:test> INSERT INTO users (user_id, first_name, last_name) VALUES (ab38ce9d-2823-4e6a-994f-7783953baef1, 'Elad', 'Karakuli'); cqlsh:test> INSERT INTO users (user_id, first_name, last_name) VALUES (5e8371a7-3ed9-479f-9e4b-e4a07c750b12, 'Alon', 'Levi'); cqlsh:test> INSERT INTO users (user_id, first_name, last_name) VALUES (ae85cdc0-5eb7-4f08-8e42-2abd89e327ed, 'Gil', 'Elias'); cqlsh:test> select user_id, first_name from users where first_name LIKE '%shl%'; user_id | first_name --+ daa312ae-ecdf-4eb4-b6e9-206e33e5ca24 | Shlomo (1 rows) cqlsh:test> select user_id, first_name from users where first_name LIKE '%Shl%'; user_id | first_name --+ daa312ae-ecdf-4eb4-b6e9-206e33e5ca24 | Shlomo (1 rows) cqlsh:test> select user_id, first_name from users where first_name LIKE 'shl%'; InvalidRequest: code=2200 [Invalid query] message="first_name LIKE '%' restriction is only supported on properly indexed columns" cqlsh:test> {noformat} > Case sensitive in LIKE query althogh index created with false > - > > Key: CASSANDRA-11389 > URL: https://issues.apache.org/jira/browse/CASSANDRA-11389 > Project: Cassandra > Issue Type: Bug > Components: sasi >Reporter: Alon Levi >Priority: Minor > Labels: sasi > Fix For: 3.x > > > I created an index on user's first name as following: > CREATE CUSTOM INDEX ON users (first_name) USING > 'org.apache.cassandra.index.sasi.SASIIndex' > with options = { > 'mode' : 'CONTAINS', > 'case_sensitive' : 'false' > }; > This is the data I have in my table > user_id | first_name > | last_name > ---+---+--- > daa312ae-ecdf-4eb4-b6e9-206e33e5ca24 | Shlomo | Cohen > ab38ce9d-2823-4e6a-994f-7783953baef1 | Elad | Karakuli > 5e8371a7-3ed9-479f-9e4b-e4a07c750b12 | Alon | Levi > ae85cdc0-5eb7-4f08-8e42-2abd89e327ed | Gil | Elias > Although i mentioned the option 'case_sensitive' : 'false' > when I run this query : > select user_id, first_name from users where first_name LIKE '%shl%'; > The query returns no results. > However, when I run this query : > select user_id, first_name from users where first_name LIKE '%Shl%'; > The query returns the right results, > and the strangest thing is when I run this query: > select user_id, first_name from users where first_name LIKE 'shl%'; > suddenly the query is no more case sensitive and the results are fine. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (CASSANDRA-11389) Case sensitive in LIKE query althogh index created with false
[ https://issues.apache.org/jira/browse/CASSANDRA-11389?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15217607#comment-15217607 ] Alon Levi commented on CASSANDRA-11389: --- Tried both of them, still no results > Case sensitive in LIKE query althogh index created with false > - > > Key: CASSANDRA-11389 > URL: https://issues.apache.org/jira/browse/CASSANDRA-11389 > Project: Cassandra > Issue Type: Bug > Components: sasi >Reporter: Alon Levi >Priority: Minor > Labels: sasi > Fix For: 3.x > > > I created an index on user's first name as following: > CREATE CUSTOM INDEX ON users (first_name) USING > 'org.apache.cassandra.index.sasi.SASIIndex' > with options = { > 'mode' : 'CONTAINS', > 'case_sensitive' : 'false' > }; > This is the data I have in my table > user_id | first_name > | last_name > ---+---+--- > daa312ae-ecdf-4eb4-b6e9-206e33e5ca24 | Shlomo | Cohen > ab38ce9d-2823-4e6a-994f-7783953baef1 | Elad | Karakuli > 5e8371a7-3ed9-479f-9e4b-e4a07c750b12 | Alon | Levi > ae85cdc0-5eb7-4f08-8e42-2abd89e327ed | Gil | Elias > Although i mentioned the option 'case_sensitive' : 'false' > when I run this query : > select user_id, first_name from users where first_name LIKE '%shl%'; > The query returns no results. > However, when I run this query : > select user_id, first_name from users where first_name LIKE '%Shl%'; > The query returns the right results, > and the strangest thing is when I run this query: > select user_id, first_name from users where first_name LIKE 'shl%'; > suddenly the query is no more case sensitive and the results are fine. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (CASSANDRA-11389) Case sensitive in LIKE query althogh index created with false
[ https://issues.apache.org/jira/browse/CASSANDRA-11389?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15217187#comment-15217187 ] Pavel Yaskevich commented on CASSANDRA-11389: - I think what is going on here is that "case_sensetive" is a feature of analyzer, indexes are not analyzed by default that's why index returns no results since that flag is simply ignored. To fix this you should set - either "analyzed": "true" or ‘analyzer_class’: ‘org.apache.cassandra.index.sasi.analyzer.NonTokenizingAnalyzer’ in the index options. > Case sensitive in LIKE query althogh index created with false > - > > Key: CASSANDRA-11389 > URL: https://issues.apache.org/jira/browse/CASSANDRA-11389 > Project: Cassandra > Issue Type: Bug > Components: sasi >Reporter: Alon Levi >Priority: Minor > Labels: sasi > Fix For: 3.x > > > I created an index on user's first name as following: > CREATE CUSTOM INDEX ON users (first_name) USING > 'org.apache.cassandra.index.sasi.SASIIndex' > with options = { > 'mode' : 'CONTAINS', > 'case_sensitive' : 'false' > }; > This is the data I have in my table > user_id | first_name > | last_name > ---+---+--- > daa312ae-ecdf-4eb4-b6e9-206e33e5ca24 | Shlomo | Cohen > ab38ce9d-2823-4e6a-994f-7783953baef1 | Elad | Karakuli > 5e8371a7-3ed9-479f-9e4b-e4a07c750b12 | Alon | Levi > ae85cdc0-5eb7-4f08-8e42-2abd89e327ed | Gil | Elias > Although i mentioned the option 'case_sensitive' : 'false' > when I run this query : > select user_id, first_name from users where first_name LIKE '%shl%'; > The query returns no results. > However, when I run this query : > select user_id, first_name from users where first_name LIKE '%Shl%'; > The query returns the right results, > and the strangest thing is when I run this query: > select user_id, first_name from users where first_name LIKE 'shl%'; > suddenly the query is no more case sensitive and the results are fine. -- This message was sent by Atlassian JIRA (v6.3.4#6332)