]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Add a few more tests for the fts4 notindexed option. fts4-notindexed
authordan <dan@noemail.net>
Fri, 21 Jun 2013 18:18:23 +0000 (18:18 +0000)
committerdan <dan@noemail.net>
Fri, 21 Jun 2013 18:18:23 +0000 (18:18 +0000)
FossilOrigin-Name: b53c0c41f97c7ddaeea61f0e6035d1c4747db3f7

manifest
manifest.uuid
test/fts3malloc.test
test/fts4noti.test

index 949e9c0e1f1f15d90cf4c90f764788ad7e46ede5..c009a5bf3df1f21f7ebec553d41f42c3db7d0271 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Add\sthe\s"notindexed"\soption\sto\sfts4.
-D 2013-06-21T17:30:47.476
+C Add\sa\sfew\smore\stests\sfor\sthe\sfts4\snotindexed\soption.
+D 2013-06-21T18:18:23.327
 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
 F Makefile.in 5e41da95d92656a5004b03d3576e8b226858a28e
 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
@@ -530,7 +530,7 @@ F test/fts3expr3.test 1bfb762b53a794f990f3dffaae8bbea5736422f7
 F test/fts3fault.test cb72dccb0a3b9f730f16c5240f3fcb9303eb1660
 F test/fts3fault2.test 3198eef2804deea7cac8403e771d9cbcb752d887
 F test/fts3first.test dbdedd20914c8d539aa3206c9b34a23775644641
-F test/fts3malloc.test b86ea33db9e8c58c0c2f8027a9fcadaf6a1568be
+F test/fts3malloc.test 1e3df7598534e77a7072aad610d46554cface3e9
 F test/fts3matchinfo.test ecb08f586d027eb03941bcfcded6cb9d8ccb3a66
 F test/fts3near.test 12895557870b0f9af7cc0be81a0171abb2d12f12
 F test/fts3prefix.test b36d4f00b128a51e7b386cc013a874246d9d7dc1
@@ -550,7 +550,7 @@ F test/fts4merge.test c424309743fdd203f8e56a1f1cd7872cd66cc0ee
 F test/fts4merge2.test 5faa558d1b672f82b847d2a337465fa745e46891
 F test/fts4merge3.test aab02a09f50fe6baaddc2e159c3eabc116d45fc7
 F test/fts4merge4.test c19c85ca1faa7b6d536832b49c12e1867235f584
-F test/fts4noti.test 7710af8ad41b23571d62c0cee2a062c30ecb8012
+F test/fts4noti.test aed33ba44808852dcb24bf70fa132e7bf530f057
 F test/fts4unicode.test c8ac44217bf6c17812b03eaafa6c06995ad304c2
 F test/full.test 6b3c8fb43c6beab6b95438c1675374b95fab245d
 F test/func.test b0fc34fdc36897769651975a2b0a606312753643
@@ -1094,10 +1094,7 @@ F tool/vdbe-compress.tcl f12c884766bd14277f4fcedcae07078011717381
 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4
 F tool/warnings.sh fbc018d67fd7395f440c28f33ef0f94420226381
 F tool/win/sqlite.vsix 97894c2790eda7b5bce3cc79cb2a8ec2fde9b3ac
-P b674462243138fcee192ef05d434665e30c681c4
-R 977878ca999ebdf95aeef1dd83187bfc
-T *branch * fts4-notindexed
-T *sym-fts4-notindexed *
-T -sym-trunk *
+P 8ff2b8f5948ccddce70102e6d68d464c66e4f7ca
+R 78eae7e4eba9ee605ccaf88bbcc953f5
 U dan
-Z 6bb2b422fa6b5870298aeb31440d85b9
+Z 1a5ea5678be579c71cc2f3fe2b3716ce
index ddcb0bcc50c39579579f0ca24bb9cd07b9f7f651..375d0c43733923d0d00d7b76bbf64f7e4da09c40 100644 (file)
@@ -1 +1 @@
-8ff2b8f5948ccddce70102e6d68d464c66e4f7ca
\ No newline at end of file
+b53c0c41f97c7ddaeea61f0e6035d1c4747db3f7
\ No newline at end of file
index 7eeee7fe0d7fa96b312ca9075dba86a098bd1933..095f9a7a500e2d2c9a1b26600157ee94dda468ef 100644 (file)
@@ -62,6 +62,9 @@ do_error_test fts3_malloc-1.5 {
 do_write_test fts3_malloc-1.6 sqlite_master {
   CREATE VIRTUAL TABLE ft6 USING fts3(a, b, tokenize porter)
 }
+do_write_test fts3_malloc-1.7 sqlite_master {
+  CREATE VIRTUAL TABLE ft7 USING fts4(a, b, notindexed=b)
+}
 
 # Test the xConnect/xDisconnect methods:
 #db eval { ATTACH 'test2.db' AS aux }
@@ -81,6 +84,7 @@ do_test fts3_malloc-2.0 {
     DROP TABLE ft3;
     DROP TABLE ft4;
     DROP TABLE ft6;
+    DROP TABLE ft7;
   }
   execsql { CREATE VIRTUAL TABLE ft USING fts3(a, b) }
   for {set ii 1} {$ii < 32} {incr ii} {
index 4a49933d0aca42d555a6a64423b59c58e18792af..e926228330dda3f3f7f8d733b6f4dec92b364b64 100644 (file)
@@ -39,6 +39,8 @@ foreach {tn arg res} {
   7 "(notindexed=a, notindexed=b, notindexed=c, a, B, c, d)" {0 {}}
   8 "(notindexed=d, content=cc)" {1 {no such column: d}}
   9 "(notindexed=a, content=cc)" {0 {}}
+  10 "(notindexed=a, notindexed=b, a)" {1 {no such column: b}}
+  11 "(notindexed=a, notindexed=b, b)" {1 {no such column: a}}
 } {
   do_catchsql_test 1.$tn "CREATE VIRTUAL TABLE t1 USING fts4 $arg" $res
   if {[lindex $res 0]==0} { execsql "DROP TABLE t1" }
@@ -50,35 +52,54 @@ do_execsql_test 1.x { SELECT name FROM sqlite_master } {cc}
 #-------------------------------------------------------------------------
 # Test that notindexed columns are not indexed.
 #
-do_execsql_test 2.1 {
-  CREATE VIRTUAL TABLE t1 USING fts4(a, b, c, notindexed=b);
-  INSERT INTO t1 VALUES('one two', 'three four', 'five six');
-  INSERT INTO t1 VALUES('three four', 'five six', 'one two');
-}
-do_execsql_test 2.2 { SELECT docid FROM t1 WHERE t1 MATCH 'one' } {1 2}
-do_execsql_test 2.3 { SELECT docid FROM t1 WHERE t1 MATCH 'three' } {2}
-do_execsql_test 2.4 { SELECT docid FROM t1 WHERE t1 MATCH 'five' } {1}
+foreach {tn schema} {
+  1 { 
+    CREATE VIRTUAL TABLE t1 USING fts4(a, b, c, notindexed=b); 
+  }
+  2 { 
+    CREATE TABLE c1(a, b, c);
+    INSERT INTO c1 VALUES('one two', 'three four', 'five six');
+    INSERT INTO c1 VALUES('three four', 'five six', 'one two');
+    CREATE VIRTUAL TABLE t1 USING fts4(content=c1, notindexed=b); 
+  }
+  3 { 
+    CREATE VIRTUAL TABLE t1 USING fts4(content="", a, b, c, notindexed=b); 
+  }
+} {
+  execsql $schema
 
-do_execsql_test 2.5 { INSERT INTO t1(t1) VALUES('optimize') }
+  do_execsql_test 2.$tn.1 {
+    INSERT INTO t1(docid,a,b,c) VALUES(1, 'one two', 'three four', 'five six');
+    INSERT INTO t1(docid,a,b,c) VALUES(2, 'three four', 'five six', 'one two');
+  }
 
-do_execsql_test 2.6 { SELECT docid FROM t1 WHERE t1 MATCH 'one' } {1 2}
-do_execsql_test 2.7 { SELECT docid FROM t1 WHERE t1 MATCH 'three' } {2}
-do_execsql_test 2.8 { SELECT docid FROM t1 WHERE t1 MATCH 'five' } {1}
+  do_execsql_test 2.$tn.2 { SELECT docid FROM t1 WHERE t1 MATCH 'one' } {1 2}
+  do_execsql_test 2.$tn.3 { SELECT docid FROM t1 WHERE t1 MATCH 'three' } {2}
+  do_execsql_test 2.$tn.4 { SELECT docid FROM t1 WHERE t1 MATCH 'five' } {1}
 
-do_execsql_test 2.9 { INSERT INTO t1(t1) VALUES('rebuild') }
+  do_execsql_test 2.$tn.5 { INSERT INTO t1(t1) VALUES('optimize') }
 
-do_execsql_test 2.10 { SELECT docid FROM t1 WHERE t1 MATCH 'one' } {1 2}
-do_execsql_test 2.11 { SELECT docid FROM t1 WHERE t1 MATCH 'three' } {2}
-do_execsql_test 2.12 { SELECT docid FROM t1 WHERE t1 MATCH 'five' } {1}
+  do_execsql_test 2.$tn.6 { SELECT docid FROM t1 WHERE t1 MATCH 'one' } {1 2}
+  do_execsql_test 2.$tn.7 { SELECT docid FROM t1 WHERE t1 MATCH 'three' } {2}
+  do_execsql_test 2.$tn.8 { SELECT docid FROM t1 WHERE t1 MATCH 'five' } {1}
 
-do_execsql_test 2.13 { 
-  SELECT * FROM t1 WHERE docid=1
-} {{one two} {three four} {five six}}
-do_execsql_test 2.14 { 
-  SELECT * FROM t1 WHERE docid=2
-} {{three four} {five six} {one two}}
+  if {$tn!=3} {
+    do_execsql_test 2.$tn.9 { INSERT INTO t1(t1) VALUES('rebuild') }
+  
+    do_execsql_test 2.$tn.10 { SELECT docid FROM t1 WHERE t1 MATCH 'one' } {1 2}
+    do_execsql_test 2.$tn.11 { SELECT docid FROM t1 WHERE t1 MATCH 'three' } {2}
+    do_execsql_test 2.$tn.12 { SELECT docid FROM t1 WHERE t1 MATCH 'five' } {1}
+  
+    do_execsql_test 2.$tn.13 { 
+      SELECT a,b,c FROM t1 WHERE docid=1
+    } {{one two} {three four} {five six}}
+    do_execsql_test 2.$tn.14 { 
+      SELECT a,b,c FROM t1 WHERE docid=2
+    } {{three four} {five six} {one two}}
+  }
 
-do_execsql_test 2.x { DROP TABLE t1 }
+  do_execsql_test 2.x { DROP TABLE t1 }
+}
 
 #-------------------------------------------------------------------------
 # Test that notindexed columns are not scanned for deferred tokens.
@@ -105,7 +126,46 @@ do_execsql_test 3.3 { SELECT x FROM t2 WHERE t2 MATCH '2' } {}
 do_execsql_test 3.4 { SELECT x FROM t2 WHERE t2 MATCH '1' } {2 3 4 5 6}
 do_execsql_test 3.5 { SELECT x FROM t2 WHERE t2 MATCH 'x' } {1 2}
 do_execsql_test 3.6 { SELECT x FROM t2 WHERE t2 MATCH 'x 1' } {2}
+
+do_execsql_test 3.x { DROP TABLE t2 }
   
+#-------------------------------------------------------------------------
+# Test that the types of notindexed columns are not modified.
+#
+do_execsql_test 4.1 {
+  CREATE VIRTUAL TABLE t2 USING fts4(poi, addr, notindexed=poi);
+  INSERT INTO t2 VALUES(114, 'x x x');
+  INSERT INTO t2 VALUES(X'1234', 'y y y');
+  INSERT INTO t2 VALUES(NULL, 'z z z');
+  INSERT INTO t2 VALUES(113.2, 'w w w');
+  INSERT INTO t2 VALUES('poi', 'v v v');
+}
+do_execsql_test 4.2 { SELECT typeof(poi) FROM t2 WHERE t2 MATCH 'x' } {integer}
+do_execsql_test 4.3 { SELECT typeof(poi) FROM t2 WHERE t2 MATCH 'y' } {blob}
+do_execsql_test 4.4 { SELECT typeof(poi) FROM t2 WHERE t2 MATCH 'z' } {null}
+do_execsql_test 4.5 { SELECT typeof(poi) FROM t2 WHERE t2 MATCH 'w' } {real}
+do_execsql_test 4.6 { SELECT typeof(poi) FROM t2 WHERE t2 MATCH 'v' } {text}
 
+do_execsql_test 4.x { DROP TABLE t2 }
+
+#-------------------------------------------------------------------------
+# Test that multiple notindexed options on a single table work as expected.
+#
+do_execsql_test 5.1 {
+  CREATE VIRTUAL TABLE t2 USING fts4(
+      notindexed="three", one, two, three, notindexed="one",
+  );
+  INSERT INTO t2 VALUES('a', 'b', 'c');
+  INSERT INTO t2 VALUES('c', 'a', 'b');
+  INSERT INTO t2 VALUES('b', 'c', 'a');
+}
+do_execsql_test 5.2 { SELECT docid FROM t2 WHERE t2 MATCH 'a' } {2}
+do_execsql_test 5.3 { SELECT docid FROM t2 WHERE t2 MATCH 'b' } {1}
+do_execsql_test 5.4 { SELECT docid FROM t2 WHERE t2 MATCH 'c' } {3}
+
+do_execsql_test 5.x { DROP TABLE t2 }
 
 finish_test
+
+
+