]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Fix a problem in FTS4 where columns with names that are prefixes of any notindexed...
authordan <dan@noemail.net>
Mon, 26 May 2014 16:40:02 +0000 (16:40 +0000)
committerdan <dan@noemail.net>
Mon, 26 May 2014 16:40:02 +0000 (16:40 +0000)
FossilOrigin-Name: d90c4964fcf46b0b043dbfd58267098582267001

ext/fts3/fts3.c
manifest
manifest.uuid
test/fts4noti.test

index c421aa92292bee7f8ef05d26446bc96f551cc537..318a927087fa2154d80559276352aead4c2db455 100644 (file)
@@ -1376,7 +1376,9 @@ static int fts3InitVtab(
     int n = (int)strlen(p->azColumn[iCol]);
     for(i=0; i<nNotindexed; i++){
       char *zNot = azNotindexed[i];
-      if( zNot && 0==sqlite3_strnicmp(p->azColumn[iCol], zNot, n) ){
+      if( zNot && strlen(zNot)==n 
+       && 0==sqlite3_strnicmp(p->azColumn[iCol], zNot, n) 
+      ){
         p->abNotindexed[iCol] = 1;
         sqlite3_free(zNot);
         azNotindexed[i] = 0;
index c39d583ac344dd47e5bf6711d08329e25d6b6735..45ee8de1d82512ba4c4728efca3623cdd2ce7101 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Remove\sreferences\sin\scomments\sto\sVDBE\sopcodes\sthat\sno\slonger\sexist.\s\sThis\nis\sa\sdocumentation\schange\sonly;\sno\schanges\sto\scode.
-D 2014-05-24T17:15:15.576
+C Fix\sa\sproblem\sin\sFTS4\swhere\scolumns\swith\snames\sthat\sare\sprefixes\sof\sany\snotindexed\scolumn\swere\salso\sbeing\s(incorrectly)\smarked\sas\snot\sindexed.\sFor\sexample\sin\s"CREATE\s...\st1(abc,\sbc,\sabcd,\snotindexed=abcd)",\sboth\sabc\sand\sabcd\swere\sbeing\streated\sas\snotindexed.
+D 2014-05-26T16:40:02.009
 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
 F Makefile.in dd2b1aba364ff9b05de41086f74407f285c57670
 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
@@ -78,7 +78,7 @@ F ext/fts3/README.content fdc666a70d5257a64fee209f97cf89e0e6e32b51
 F ext/fts3/README.syntax a19711dc5458c20734b8e485e75fb1981ec2427a
 F ext/fts3/README.tokenizers e0a8b81383ea60d0334d274fadf305ea14a8c314
 F ext/fts3/README.txt 8c18f41574404623b76917b9da66fcb0ab38328d
-F ext/fts3/fts3.c e83f894cf1adaf8decd6b1de76bfdcdb79b25507
+F ext/fts3/fts3.c 0a9813c01ce7cc33d63680725ea30755d77c7b39
 F ext/fts3/fts3.h 3a10a0af180d502cecc50df77b1b22df142817fe
 F ext/fts3/fts3Int.h 16cddf2d7b0e5f3681615ae1d8ca0e45fca44918
 F ext/fts3/fts3_aux.c 5c211e17a64885faeb16b9ba7772f9d5445c2365
@@ -578,7 +578,7 @@ F test/fts4merge.test c424309743fdd203f8e56a1f1cd7872cd66cc0ee
 F test/fts4merge2.test 5faa558d1b672f82b847d2a337465fa745e46891
 F test/fts4merge3.test aab02a09f50fe6baaddc2e159c3eabc116d45fc7
 F test/fts4merge4.test d895b1057a7798b67e03455d0fa50e9ea836c47b
-F test/fts4noti.test aed33ba44808852dcb24bf70fa132e7bf530f057
+F test/fts4noti.test 9695c7c6c32480ea9fc20a2b38ed1de0640bcaec
 F test/fts4unicode.test 01ec3fe2a7c3cfff3b4c0581b83caa11b33efa36
 F test/full.test 6b3c8fb43c6beab6b95438c1675374b95fab245d
 F test/func.test ae97561957aba6ca9e3a7b8a13aac41830d701ef
@@ -1172,7 +1172,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1
 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4
 F tool/warnings.sh d1a6de74685f360ab718efda6265994b99bbea01
 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f
-P 9268df305b90ac11e44b3107bbab5becf38860b7
-R bc701579fd7f073e7430b8784d345a7f
-U drh
-Z e5b850c5c7a548d035682ab5ac668a73
+P ebfb51fe40756713d269b4c0ade752666910bb6e
+R 36deadd8d69ebb9247626122117eb3bc
+U dan
+Z 0240f0d26606ac6bcf34313be52fa724
index 84e009386b103863f92c63e5e11b6e60531089ae..fd33e73170e67f141861fe1408d416cec37d08fe 100644 (file)
@@ -1 +1 @@
-ebfb51fe40756713d269b4c0ade752666910bb6e
\ No newline at end of file
+d90c4964fcf46b0b043dbfd58267098582267001
\ No newline at end of file
index e926228330dda3f3f7f8d733b6f4dec92b364b64..1b39a73950dbf1f8d25d1951b863f57b3d396411 100644 (file)
@@ -165,6 +165,51 @@ do_execsql_test 5.4 { SELECT docid FROM t2 WHERE t2 MATCH 'c' } {3}
 
 do_execsql_test 5.x { DROP TABLE t2 }
 
+#-------------------------------------------------------------------------
+# Check that if an indexed column name is a prefix of a notindexed column
+# name, the column is still correctly tokenized. This was a problem at one
+# point.
+do_execsql_test 6.1.1 {
+  CREATE VIRTUAL TABLE t1 USING fts4(
+    poiCategory, poiCategoryId, notindexed=poiCategoryId
+  );
+  INSERT INTO t1(poiCategory, poiCategoryId) values ("Restaurant", 6021);
+}
+
+do_execsql_test 6.1.2 {
+  SELECT * FROM t1 WHERE t1 MATCH 'restaurant';
+} { Restaurant 6021 }
+do_execsql_test 6.1.3 {
+  SELECT * FROM t1 WHERE t1 MATCH 're*';
+} { Restaurant 6021 }
+do_execsql_test 6.1.4 {
+  SELECT * FROM t1 WHERE t1 MATCH '6021';
+} {}
+do_execsql_test 6.1.5 {
+  SELECT * FROM t1 WHERE t1 MATCH '60*';
+} {}
+
+do_execsql_test 6.2.1 {
+  DROP TABLE t1;
+  CREATE VIRTUAL TABLE t1 USING fts4(
+    poiCategory, poiCategoryId, notindexed=poiCategory
+  );
+  INSERT INTO t1(poiCategory, poiCategoryId) values ("Restaurant", 6021);
+}
+
+do_execsql_test 6.2.2 {
+  SELECT * FROM t1 WHERE t1 MATCH 'restaurant';
+} {}
+do_execsql_test 6.2.3 {
+  SELECT * FROM t1 WHERE t1 MATCH 're*';
+} {}
+do_execsql_test 6.2.4 {
+  SELECT * FROM t1 WHERE t1 MATCH '6021';
+} { Restaurant 6021 }
+do_execsql_test 6.2.5 {
+  SELECT * FROM t1 WHERE t1 MATCH '60*';
+} { Restaurant 6021 }
+
 finish_test