]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
The snippet generator adds ellipsis between text from different columns. (CVS 3465)
authordrh <drh@noemail.net>
Wed, 4 Oct 2006 17:35:28 +0000 (17:35 +0000)
committerdrh <drh@noemail.net>
Wed, 4 Oct 2006 17:35:28 +0000 (17:35 +0000)
FossilOrigin-Name: 6cf1fb9f801dc1b2865c0d1f9afb1b2076d4246e

ext/fts1/fts1.c
manifest
manifest.uuid
test/fts1c.test

index c13f7647aad04d131057811d923887769c9276bd..a099c17eeaa87dfc5954f9eb1f49cd9547df51ad 100644 (file)
@@ -2366,13 +2366,12 @@ static void snippetText(
   int nMatch;
   int nDesired;
   StringBuffer sb;
-  int tailCol = -1;
-  int tailOffset = -1;
+  int tailCol;
+  int tailOffset;
   int iCol;
   int nDoc;
   const char *zDoc;
   int iStart, iEnd;
-  int wantEllipsis;
   int tailEllipsis = 0;
   int iMatch;
   
@@ -2398,6 +2397,8 @@ static void snippetText(
   }
 
   iMatch = 0;
+  tailCol = -1;
+  tailOffset = 0;
   for(i=0; i<nMatch && nDesired>0; i++){
     if( aMatch[i].snStatus!=SNIPPET_DESIRED ) continue;
     nDesired--;
@@ -2408,20 +2409,13 @@ static void snippetText(
     iStart = wordBoundary(iStart, zDoc, nDoc, aMatch, nMatch, iCol);
     if( iStart<=10 ){
       iStart = 0;
-      wantEllipsis = 0;
-    }else{
-      wantEllipsis = 1;
     }
     if( iCol==tailCol && iStart<=tailOffset+20 ){
       iStart = tailOffset;
-      wantEllipsis = 0;
-      tailEllipsis = 0;
     }
-    if( iCol!=tailCol || iStart!=tailOffset ){
+    if( (iCol!=tailCol && tailCol>=0) || iStart!=tailOffset ){
       trimWhiteSpace(&sb);
       appendWhiteSpace(&sb);
-    }
-    if( wantEllipsis || tailEllipsis ){
       append(&sb, zEllipsis);
       appendWhiteSpace(&sb);
     }
index 2d8c7fd138a7fdccd0d8028e5456829573b83579..d4d4e9f04cfedd7cbcc41f0b4ac78e4892edcd90 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Fix\sUTF\sconversions\sfor\s-O2\son\sgcc\s4.1.1.\s\sTicket\s#2008.\s(CVS\s3464)
-D 2006-10-04T15:23:22
+C The\ssnippet\sgenerator\sadds\sellipsis\sbetween\stext\sfrom\sdifferent\scolumns.\s(CVS\s3465)
+D 2006-10-04T17:35:28
 F Makefile.in 4379c909d46b38b8c5db3533084601621d4f14b2
 F Makefile.linux-gcc 2d8574d1ba75f129aba2019f0b959db380a90935
 F README 9c4e2d6706bdcc3efdd773ce752a8cdab4f90028
@@ -21,7 +21,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 6eca4867e4c4288747534e548ea0c8a7026afbfa
+F ext/fts1/fts1.c 37ba4a1cf2489e98491fa2767f9e75d87dbc318e
 F ext/fts1/fts1.h 6060b8f62c1d925ea8356cb1a6598073eb9159a6
 F ext/fts1/fts1_hash.c 3196cee866edbebb1c0521e21672e6d599965114
 F ext/fts1/fts1_hash.h 957d378355ed29f672cd5add012ce8b088a5e089
@@ -193,7 +193,7 @@ F test/fkey1.test 153004438d51e6769fb1ce165f6313972d6263ce
 F test/format4.test bf3bed3b13c63abfb3cfec232597a319a31d0bcc
 F test/fts1a.test 46090311f85da51bb33bd5ce84f7948359c6d8d7
 F test/fts1b.test 5d8a01aefbecc8b7442b36c94c05eb7a845462d5
-F test/fts1c.test 8790cc74bfc3141772f5cc0252dcdef20832f755
+F test/fts1c.test 85a525ce7428907469b4cce13d5563ce542ce64c
 F test/fts1d.test a73deace5c18df4a549b12908bade4f05dcf1a2f
 F test/fts1porter.test d86e9c3e0c7f8ff95add6582b4b585fb4e02b96d
 F test/func.test 0ed54b5aeaad319f68016c033acfebef56f5874a
@@ -402,7 +402,7 @@ F www/tclsqlite.tcl bb0d1357328a42b1993d78573e587c6dcbc964b9
 F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0
 F www/version3.tcl 890248cf7b70e60c383b0e84d77d5132b3ead42b
 F www/whentouse.tcl 97e2b5cd296f7d8057e11f44427dea8a4c2db513
-P eef0ec0d7ae0743d29454567f539e46ad2d5008e
-R d5b9f813970a158cf400394eee3842a8
+P 86a08bb7c5da42fbeb5a026287d67912a2ffb7f1
+R c71cdbdbaa74de712bb1ae9465bd527d
 U drh
-Z 59839b6801d726e2458ae7f941423cf8
+Z f00b4a0381f58882003326222b2c2698
index 944c08480ea0f76e72736deae658e64ff5031102..8154076cc48ad2641403ee96addb04994f9cddd0 100644 (file)
@@ -1 +1 @@
-86a08bb7c5da42fbeb5a026287d67912a2ffb7f1
\ No newline at end of file
+6cf1fb9f801dc1b2865c0d1f9afb1b2076d4246e
\ No newline at end of file
index 3c5ff7ef0c2f417dce3186c05879e7001435d7c7..a12469593aa5b4a2b1d18c4c534f9a6619d433d2 100644 (file)
@@ -11,7 +11,7 @@
 # This file implements regression tests for SQLite library.  The
 # focus of this script is testing the FTS1 module.
 #
-# $Id: fts1c.test,v 1.10 2006/09/28 19:43:32 drh Exp $
+# $Id: fts1c.test,v 1.11 2006/10/04 17:35:28 drh Exp $
 #
 
 set testdir [file dirname $argv0]
@@ -1156,13 +1156,13 @@ do_test fts1c-4.5 {
     SELECT snippet(email,'<<<','>>>',' ') FROM email
      WHERE email MATCH 'first things'
   }
-} {{Re: <<<First>>> Polish Deal! Congrats!  <<<Things>>> seem to be building rapidly now on the  }}
+} {{Re: <<<First>>> Polish Deal!  Congrats!  <<<Things>>> seem to be building rapidly now on the  }}
 do_test fts1c-4.6 {
   execsql {
     SELECT snippet(email) FROM email
      WHERE email MATCH 'chris is here'
   }
-} {{<b>chris</b>.germany@enron.com Sounds good to me.  I bet this <b>is</b> next to the Warick?? Hotel. <b>...</b> place.? What do you think about going <b>here</b> Christmas 
+} {{<b>chris</b>.germany@enron.com <b>...</b> Sounds good to me.  I bet this <b>is</b> next to the Warick?? Hotel. <b>...</b> place.? What do you think about going <b>here</b> Christmas 
 eve?? They have an 11:00 a.m. <b>...</b>}}
 do_test fts1c-4.7 {
   execsql {
@@ -1177,7 +1177,7 @@ do_test fts1c-4.8 {
     SELECT snippet(email) FROM email
      WHERE email MATCH 'ancillary load davis'
   }
-} {{pete.<b>davis</b>@enron.com Start Date: 4/22/01; HourAhead hour: 3;  No <b>ancillary</b> schedules awarded.  
+} {{pete.<b>davis</b>@enron.com <b>...</b> Start Date: 4/22/01; HourAhead hour: 3;  No <b>ancillary</b> schedules awarded.  
 Variances detected.
 Variances detected in <b>Load</b> schedule.