From 9f8a4b43ef609fdac635c1d8afed2d2e89a1aeb2 Mon Sep 17 00:00:00 2001 From: shess Date: Wed, 25 Jul 2007 00:25:20 +0000 Subject: [PATCH] Apply change 4095 to fts1. Fix snippet generation when the left-most column of an fts table is used in the MATCH clause. Fix for ticket #2429. (CVS 4181) FossilOrigin-Name: c2ba3cc0f7ac9f5dfe5ffb554f9a1cd96b28335a --- ext/fts1/fts1.c | 1 + manifest | 15 ++++++++------- manifest.uuid | 2 +- test/fts1m.test | 50 +++++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 60 insertions(+), 8 deletions(-) create mode 100644 test/fts1m.test diff --git a/ext/fts1/fts1.c b/ext/fts1/fts1.c index cdc4711542..c73989bc58 100644 --- a/ext/fts1/fts1.c +++ b/ext/fts1/fts1.c @@ -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; diff --git a/manifest b/manifest index eafe024073..cf30d29fce 100644 --- 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 diff --git a/manifest.uuid b/manifest.uuid index efbdfbaa0f..aa95ceb8d7 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -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 index 0000000000..c2f8f915a1 --- /dev/null +++ b/test/fts1m.test @@ -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 four two}} +do_test fts1m-1.2 { + execsql { + SELECT rowid, snippet(t1) FROM t1 WHERE b MATCH 'four'; + } +} {1 {one four}} +do_test fts1m-1.3 { + execsql { + SELECT rowid, snippet(t1) FROM t1 WHERE a MATCH 'four'; + } +} {1 {one three four}} + +finish_test -- 2.47.3