/ Check-in [ab85a6fc]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Change the fts5 multi-column syntax to use parenthesis instead of square brackets.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | fts5
Files: files | file ages | folders
SHA1: ab85a6fc4f7580278fc9d1f0090fdcf0a90d065b
User & Date: dan 2015-06-02 19:38:15
Context
2015-06-03
11:23
Fix an fts5 problem in extracting columns from position lists containing large varints. check-in: 4ea015ab user: dan tags: fts5
2015-06-02
19:38
Change the fts5 multi-column syntax to use parenthesis instead of square brackets. check-in: ab85a6fc user: dan tags: fts5
18:07
Merge latest trunk changes with this branch. check-in: c9ffda4a user: dan tags: fts5
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to ext/fts5/fts5_expr.c.

150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
  while( fts5ExprIsspace(*z) ) z++;

  pToken->p = z;
  pToken->n = 1;
  switch( *z ){
    case '(':  tok = FTS5_LP;    break;
    case ')':  tok = FTS5_RP;    break;
    case '[':  tok = FTS5_LSP;   break;
    case ']':  tok = FTS5_RSP;   break;
    case ':':  tok = FTS5_COLON; break;
    case ',':  tok = FTS5_COMMA; break;
    case '+':  tok = FTS5_PLUS;  break;
    case '*':  tok = FTS5_STAR;  break;
    case '\0': tok = FTS5_EOF;   break;

    case '"': {







|
|







150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
  while( fts5ExprIsspace(*z) ) z++;

  pToken->p = z;
  pToken->n = 1;
  switch( *z ){
    case '(':  tok = FTS5_LP;    break;
    case ')':  tok = FTS5_RP;    break;
    case '{':  tok = FTS5_LCP;   break;
    case '}':  tok = FTS5_RCP;   break;
    case ':':  tok = FTS5_COLON; break;
    case ',':  tok = FTS5_COMMA; break;
    case '+':  tok = FTS5_PLUS;  break;
    case '*':  tok = FTS5_STAR;  break;
    case '\0': tok = FTS5_EOF;   break;

    case '"': {

Changes to ext/fts5/fts5parse.y.

102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
}

%type colset {Fts5ExprColset*}
%destructor colset { sqlite3_free($$); }
%type colsetlist {Fts5ExprColset*}
%destructor colsetlist { sqlite3_free($$); }

colset(A) ::= LSP colsetlist(X) RSP. { A = X; }
colset(A) ::= STRING(X). {
  A = sqlite3Fts5ParseColset(pParse, 0, &X);
}

colsetlist(A) ::= colsetlist(Y) STRING(X). { 
  A = sqlite3Fts5ParseColset(pParse, Y, &X); }
colsetlist(A) ::= STRING(X). { 







|







102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
}

%type colset {Fts5ExprColset*}
%destructor colset { sqlite3_free($$); }
%type colsetlist {Fts5ExprColset*}
%destructor colsetlist { sqlite3_free($$); }

colset(A) ::= LCP colsetlist(X) RCP. { A = X; }
colset(A) ::= STRING(X). {
  A = sqlite3Fts5ParseColset(pParse, 0, &X);
}

colsetlist(A) ::= colsetlist(Y) STRING(X). { 
  A = sqlite3Fts5ParseColset(pParse, Y, &X); }
colsetlist(A) ::= STRING(X). { 

Changes to ext/fts5/test/fts5ac.test.

254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
  # Queries on a specific column.
  #
  foreach {tn expr} {
    1.1 "x:a"
    1.2 "y:a"
    1.3 "x:b"
    1.4 "y:b"
    2.1 "[x]:a"
    2.2 "[y]:a"
    2.3 "[x]:b"
    2.4 "[y]:b"

    3.1 "[x y]:a"
    3.2 "[y x]:a"
    3.3 "[x x]:b"
    3.4 "[y y]:b"

    4.1 {["x" "y"]:a}
    4.2 {["y" x]:a}
    4.3 {[x "x"]:b}
    4.4 {["y" y]:b}
  } {
    set res [matchdata 1 $expr]
    do_execsql_test $tn2.3.$tn.[llength $res] { 
      SELECT rowid, fts5_test_poslist(xx) FROM xx WHERE xx match $expr
    } $res
  }








|
|
|
|

|
|
|
|

|
|
|
|







254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
  # Queries on a specific column.
  #
  foreach {tn expr} {
    1.1 "x:a"
    1.2 "y:a"
    1.3 "x:b"
    1.4 "y:b"
    2.1 "{x}:a"
    2.2 "{y}:a"
    2.3 "{x}:b"
    2.4 "{y}:b"

    3.1 "{x y}:a"
    3.2 "{y x}:a"
    3.3 "{x x}:b"
    3.4 "{y y}:b"

    4.1 {{"x" "y"}:a}
    4.2 {{"y" x}:a}
    4.3 {{x "x"}:b}
    4.4 {{"y" y}:b}
  } {
    set res [matchdata 1 $expr]
    do_execsql_test $tn2.3.$tn.[llength $res] { 
      SELECT rowid, fts5_test_poslist(xx) FROM xx WHERE xx match $expr
    } $res
  }

Changes to ext/fts5/test/fts5auto.test.

297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
    }
    }
  }
  execsql COMMIT


  foreach {tn expr} {
    A.1 { [a] : x }
    A.2 { [a b] : x }
    A.3 { [a b f] : x }
    A.4 { [f a b] : x }
    A.5 { [f a b] : x y }
    A.6 { [f a b] : x + y }
    A.7 { [c a b] : x + c }
    A.8 { [c d] : "l m" }
    A.9 { [c e] : "l m" }

    B.1 { a NOT b }
    B.2 { a NOT a:b }
    B.3 { a OR (b AND c) }
    B.4 { a OR (b AND [a b c]:c) }
    B.5 { a OR "b c" }
    B.6 { a OR b OR c }

    C.1 { a OR (b AND "b c") }
    C.2 { a OR (b AND "z c") }
  } {
    do_auto_test 3.$fold.$tn $expr
  }
}

finish_test








|
|
|
|
|
|
|
|
|




|












297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
    }
    }
  }
  execsql COMMIT


  foreach {tn expr} {
    A.1 { {a} : x }
    A.2 { {a b} : x }
    A.3 { {a b f} : x }
    A.4 { {f a b} : x }
    A.5 { {f a b} : x y }
    A.6 { {f a b} : x + y }
    A.7 { {c a b} : x + c }
    A.8 { {c d} : "l m" }
    A.9 { {c e} : "l m" }

    B.1 { a NOT b }
    B.2 { a NOT a:b }
    B.3 { a OR (b AND c) }
    B.4 { a OR (b AND {a b c}:c) }
    B.5 { a OR "b c" }
    B.6 { a OR b OR c }

    C.1 { a OR (b AND "b c") }
    C.2 { a OR (b AND "z c") }
  } {
    do_auto_test 3.$fold.$tn $expr
  }
}

finish_test