]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Apply change 4095 to fts1. Fix snippet generation when the left-most
authorshess <shess@noemail.net>
Wed, 25 Jul 2007 00:25:20 +0000 (00:25 +0000)
committershess <shess@noemail.net>
Wed, 25 Jul 2007 00:25:20 +0000 (00:25 +0000)
column of an fts table is used in the MATCH clause. Fix for ticket
#2429. (CVS 4181)

FossilOrigin-Name: c2ba3cc0f7ac9f5dfe5ffb554f9a1cd96b28335a

ext/fts1/fts1.c
manifest
manifest.uuid
test/fts1m.test [new file with mode: 0644]

index cdc4711542e612b79a6e337af3eebec88a8046d3..c73989bc58f090d931ecff2d1170524378986dbf 100644 (file)
@@ -2281,6 +2281,7 @@ static void snippetAllOffsets(fulltext_cursor *p){
   pFts = p->q.pFts;
   nColumn = pFts->nColumn;
   iColumn = p->iCursorType;
+  iColumn = p->iCursorType - QUERY_FULLTEXT;
   if( iColumn<0 || iColumn>=nColumn ){
     iFirst = 0;
     iLast = nColumn-1;
index eafe024073d5eba18e72e4064f42cdb12e65f138..cf30d29fce30ab02b8f1a142657ae458c0f3c4fc 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Remove\sthe\scomment\sin\sthe\sdocumentation\sthat\ssays\sthat\sincremental\svacuum\nmode\sis\snot\spersistent\sbecause\sas\sof\s3.4.1\sit\sis\spersistent.\s\sTicket\s#2528.\s(CVS\s4180)
-D 2007-07-24T10:22:58
+C Apply\schange\s4095\sto\sfts1.\s\sFix\ssnippet\sgeneration\swhen\sthe\sleft-most\ncolumn\sof\san\sfts\stable\sis\sused\sin\sthe\sMATCH\sclause.\sFix\sfor\sticket\n#2429.\s(CVS\s4181)
+D 2007-07-25T00:25:20
 F Makefile.in 0c0e53720f658c7a551046442dd7afba0b72bfbe
 F Makefile.linux-gcc 65241babba6faf1152bf86574477baab19190499
 F README 9c4e2d6706bdcc3efdd773ce752a8cdab4f90028
@@ -24,7 +24,7 @@ F ext/README.txt 913a7bd3f4837ab14d7e063304181787658b14e1
 F ext/fts1/README.txt 20ac73b006a70bcfd80069bdaf59214b6cf1db5e
 F ext/fts1/ft_hash.c 3927bd880e65329bdc6f506555b228b28924921b
 F ext/fts1/ft_hash.h 1a35e654a235c2c662d3ca0dfc3138ad60b8b7d5
-F ext/fts1/fts1.c b51a4e2712a29ade1ccf2300ca293819e9f17b86
+F ext/fts1/fts1.c cb12e67591a1c6e8d4201d1e9a271904d949c2c9
 F ext/fts1/fts1.h 6060b8f62c1d925ea8356cb1a6598073eb9159a6
 F ext/fts1/fts1_hash.c 3196cee866edbebb1c0521e21672e6d599965114
 F ext/fts1/fts1_hash.h 957d378355ed29f672cd5add012ce8b088a5e089
@@ -242,6 +242,7 @@ F test/fts1i.test 6bfe08cdfdced063a39a50c8601da65e6274d879
 F test/fts1j.test e4c0ffcd0ba2adce09c6b7b43ffd0749b5fda5c7
 F test/fts1k.test fdf295cb797ba6a2ef81ec41cb98df0ceb2e572c
 F test/fts1l.test 15c119ed2362b2b28d5300c0540a6a43eab66c36
+F test/fts1m.test 2d9ca67b095d49f037a914087cc0a61e89da4f0c
 F test/fts1porter.test d86e9c3e0c7f8ff95add6582b4b585fb4e02b96d
 F test/fts2a.test 473a5c8b473a4e21a8e3fddaed1e59666e0c6ab7
 F test/fts2b.test 964abc0236c849c07ca1ae496bb25c268ae94816
@@ -520,7 +521,7 @@ F www/tclsqlite.tcl 8be95ee6dba05eabcd27a9d91331c803f2ce2130
 F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0
 F www/version3.tcl 890248cf7b70e60c383b0e84d77d5132b3ead42b
 F www/whentouse.tcl fc46eae081251c3c181bd79c5faef8195d7991a5
-P de000280c6d0b13440d2450eb6ba42073ad46c56
-R ad80a56b3a68737b904d5cfe96ac37aa
-U drh
-Z 557bd921e0baa7785a73ccc814a08459
+P 6c4040941e3cf84ac0b1f5797cd700c7a2ce9353
+R 7022e666e237dc6fba6b28a2471e3066
+U shess
+Z 911c02df1bb9d22928aeb4ea61d035a2
index efbdfbaa0fd1b838b3fdff9dbab2f3e3019c9089..aa95ceb8d74a52fea4ea9f54c36f4c983f22bed9 100644 (file)
@@ -1 +1 @@
-6c4040941e3cf84ac0b1f5797cd700c7a2ce9353
\ No newline at end of file
+c2ba3cc0f7ac9f5dfe5ffb554f9a1cd96b28335a
\ No newline at end of file
diff --git a/test/fts1m.test b/test/fts1m.test
new file mode 100644 (file)
index 0000000..c2f8f91
--- /dev/null
@@ -0,0 +1,50 @@
+# 2007 July 27
+#
+# The author disclaims copyright to this source code.  In place of
+# a legal notice, here is a blessing:
+#
+#    May you do good and not evil.
+#    May you find forgiveness for yourself and forgive others.
+#    May you share freely, never taking more than you give.
+#
+#*************************************************************************
+# This file implements regression tests for SQLite library.  The focus
+# of this script is testing the FTS1 module, specifically snippet
+# generation.  Extracted from fts2o.test.
+#
+# $Id: fts1m.test,v 1.1 2007/07/25 00:25:20 shess Exp $
+#
+
+set testdir [file dirname $argv0]
+source $testdir/tester.tcl
+
+# If SQLITE_ENABLE_FTS1 is not defined, omit this file.
+ifcapable !fts1 {
+  finish_test
+  return
+}
+
+#---------------------------------------------------------------------
+# These tests, fts1m-1.*, test that ticket #2429 is fixed.
+#
+db eval {
+  CREATE VIRTUAL TABLE t1 USING fts1(a, b, c);
+  INSERT INTO t1(a, b, c) VALUES('one three four', 'one four', 'one four two');
+}
+do_test fts1m-1.1 {
+  execsql {
+    SELECT rowid, snippet(t1) FROM t1 WHERE c MATCH 'four';
+  }
+} {1 {one <b>four</b> two}}
+do_test fts1m-1.2 {
+  execsql {
+    SELECT rowid, snippet(t1) FROM t1 WHERE b MATCH 'four';
+  }
+} {1 {one <b>four</b>}}
+do_test fts1m-1.3 {
+  execsql {
+    SELECT rowid, snippet(t1) FROM t1 WHERE a MATCH 'four';
+  }
+} {1 {one three <b>four</b>}}
+
+finish_test