/ Check-in [df1a4b48]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Make DL_POSITION the default mode in FTS1. Remove the need to compile with SQLITE_CORE when SQLITE_ENABLE_FTS1 is used. (CVS 3462)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: df1a4b4834fdc88056371bcc767c5dfde2eaab72
User & Date: drh 2006-10-03 19:37:37
Context
2006-10-04
11:55
Tests cases automatically remove many of their temporary files. (CVS 3463) check-in: eef0ec0d user: drh tags: trunk
2006-10-03
19:37
Make DL_POSITION the default mode in FTS1. Remove the need to compile with SQLITE_CORE when SQLITE_ENABLE_FTS1 is used. (CVS 3462) check-in: df1a4b48 user: drh tags: trunk
19:12
Modify the makefile(s) to know about the FTS1 module - however FTS1 is turned off by default. Bump the version number to 3.3.8. (CVS 3461) check-in: 288ff637 user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to ext/fts1/fts1.c.

     9      9   **     * The FTS1 module is being built as an extension
    10     10   **       (in which case SQLITE_CORE is not defined), or
    11     11   **
    12     12   **     * The FTS1 module is being built into the core of
    13     13   **       SQLite (in which case SQLITE_ENABLE_FTS1 is defined).
    14     14   */
    15     15   #if !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS1)
           16  +
           17  +#if defined(SQLITE_ENABLE_FTS1) && !defined(SQLITE_CORE)
           18  +# define SQLITE_CORE 1
           19  +#endif
    16     20   
    17     21   #include <assert.h>
    18     22   #if !defined(__APPLE__)
    19     23   #include <malloc.h>
    20     24   #else
    21     25   #include <stdlib.h>
    22     26   #endif
................................................................................
   176    180   typedef enum DocListType {
   177    181     DL_DOCIDS,              /* docids only */
   178    182     DL_POSITIONS,           /* docids + positions */
   179    183     DL_POSITIONS_OFFSETS    /* docids + positions + offsets */
   180    184   } DocListType;
   181    185   
   182    186   /*
   183         -** By default, positions and offsets are stored in the doclists.
   184         -** To change this so that only positions are stored, compile
   185         -** with
          187  +** By default, only positions and not offsets are stored in the doclists.
          188  +** To change this so that offsets are stored too, compile with
   186    189   **
   187         -**          -DDL_DEFAULT=DL_POSITIONS
          190  +**          -DDL_DEFAULT=DL_POSITIONS_OFFSETS
   188    191   **
   189    192   */
   190    193   #ifndef DL_DEFAULT
   191         -# define DL_DEFAULT DL_POSITIONS_OFFSETS
          194  +# define DL_DEFAULT DL_POSITIONS
   192    195   #endif
   193    196   
   194    197   typedef struct DocList {
   195    198     char *pData;
   196    199     int nData;
   197    200     DocListType iType;
   198    201     int iLastColumn;    /* the last column written */
................................................................................
  1908   1911     v->azColumn = spec->azColumn;
  1909   1912     spec->azColumn = 0;
  1910   1913   
  1911   1914     if( spec->azTokenizer==0 ){
  1912   1915       return SQLITE_NOMEM;
  1913   1916     }
  1914   1917     /* TODO(shess) For now, add new tokenizers as else if clauses. */
  1915         -  if( spec->azTokenizer[0]==0 || !strcmp(spec->azTokenizer[0], "simple") ){
         1918  +  if( spec->azTokenizer[0]==0 || startsWith(spec->azTokenizer[0], "simple") ){
  1916   1919       sqlite3Fts1SimpleTokenizerModule(&m);
  1917         -  }else if( strcmp(spec->azTokenizer[0], "porter")==0 ){
         1920  +  }else if( startsWith(spec->azTokenizer[0], "porter") ){
  1918   1921       sqlite3Fts1PorterTokenizerModule(&m);
  1919   1922     }else{
  1920   1923       *pzErr = sqlite3_mprintf("unknown tokenizer: %s", spec->azTokenizer[0]);
  1921   1924       rc = SQLITE_ERROR;
  1922   1925       goto err;
  1923   1926     }
  1924   1927     for(n=0; spec->azTokenizer[n]; n++){}

Changes to test/fts1porter.test.

     8      8   #    May you share freely, never taking more than you give.
     9      9   #
    10     10   #*************************************************************************
    11     11   # This file implements regression tests for SQLite library.  The
    12     12   # focus of this script is testing the FTS1 module, and in particular
    13     13   # the Porter stemmer.
    14     14   #
    15         -# $Id: fts1porter.test,v 1.4 2006/10/01 20:41:03 drh Exp $
           15  +# $Id: fts1porter.test,v 1.5 2006/10/03 19:37:37 drh Exp $
    16     16   #
    17     17   
    18     18   set testdir [file dirname $argv0]
    19     19   source $testdir/tester.tcl
    20     20   
    21     21   # If SQLITE_ENABLE_FTS1 is defined, omit this file.
    22     22   ifcapable !fts1 {
................................................................................
 23569  23569   }                         
 23570  23570   
 23571  23571   # Create a full-text index to use for testing the stemmer.
 23572  23572   #
 23573  23573   db close
 23574  23574   sqlite3 db :memory:
 23575  23575   db eval {
 23576         -  CREATE VIRTUAL TABLE t1 USING fts1(word, tokenize porter);
        23576  +  CREATE VIRTUAL TABLE t1 USING fts1(word, tokenize Porter);
 23577  23577   }
 23578  23578   
 23579  23579   foreach {pfrom pto} $porter_test_data {
 23580  23580     do_test fts1porter-$pfrom {
 23581  23581       execsql {
 23582  23582         DELETE FROM t1_term;
 23583  23583         DELETE FROM t1_content;