Uploaded image for project: 'Cassandra'
  1. Cassandra
  2. CASSANDRA-11131

[SASI Pre-QA] Allow '<term>%' syntax for CONTAINS mode

    Details

    • Type: Improvement
    • Status: Resolved
    • Priority: Normal
    • Resolution: Not A Problem
    • Fix Version/s: 3.4
    • Component/s: Legacy/CQL
    • Labels:
      None
    • Environment:

      Tested from build CASSANDRA-11067

      Description

      Tested from build CASSANDRA-11067

      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 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"
      
      

      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>%

        Attachments

          Activity

            People

            • Assignee:
              xedin Pavel Yaskevich
              Reporter:
              doanduyhai DOAN DuyHai
              Authors:
              Pavel Yaskevich
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: