/ Check-in [f30afd20]
Login

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

Overview
Comment:Ensure an up to date copy of the fts5 configuration has been loaded into memory before attempting to modify the same configuration.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | fts5
Files: files | file ages | folders
SHA1: f30afd209aa4ce42766b1493750c4f5b5f1e9502
User & Date: dan 2015-01-17 20:01:52
Context
2015-01-19
11:15
Handle the case where a tokenizer determines that there are zero tokens in an fts5 query term. check-in: 75f3d17f user: dan tags: fts5
2015-01-17
20:01
Ensure an up to date copy of the fts5 configuration has been loaded into memory before attempting to modify the same configuration. check-in: f30afd20 user: dan tags: fts5
17:48
Improve the performance of the fts5 porter tokenizer implementation. check-in: 96ea6004 user: dan tags: fts5
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to ext/fts5/fts5.c.

  1081   1081         rc = sqlite3Fts5StorageRebuild(pTab->pStorage);
  1082   1082       }
  1083   1083     }else if( 0==sqlite3_stricmp("optimize", z) ){
  1084   1084       rc = sqlite3Fts5StorageOptimize(pTab->pStorage);
  1085   1085     }else if( 0==sqlite3_stricmp("integrity-check", z) ){
  1086   1086       rc = sqlite3Fts5StorageIntegrity(pTab->pStorage);
  1087   1087     }else{
  1088         -    rc = sqlite3Fts5ConfigSetValue(pTab->pConfig, z, pVal, &bError);
         1088  +    rc = sqlite3Fts5IndexLoadConfig(pTab->pIndex);
         1089  +    if( rc==SQLITE_OK ){
         1090  +      rc = sqlite3Fts5ConfigSetValue(pTab->pConfig, z, pVal, &bError);
         1091  +    }
  1089   1092       if( rc==SQLITE_OK ){
  1090   1093         if( bError ){
  1091   1094           rc = SQLITE_ERROR;
  1092   1095         }else{
  1093   1096           rc = sqlite3Fts5StorageConfigValue(pTab->pStorage, z, pVal);
  1094   1097         }
  1095   1098       }

Changes to ext/fts5/fts5Int.h.

   338    338   ** Return the total number of entries read from the %_data table by 
   339    339   ** this connection since it was created.
   340    340   */
   341    341   int sqlite3Fts5IndexReads(Fts5Index *p);
   342    342   
   343    343   int sqlite3Fts5IndexReinit(Fts5Index *p);
   344    344   int sqlite3Fts5IndexOptimize(Fts5Index *p);
          345  +
          346  +int sqlite3Fts5IndexLoadConfig(Fts5Index *p);
   345    347   
   346    348   /*
   347    349   ** End of interface to code in fts5_index.c.
   348    350   **************************************************************************/
   349    351   
   350    352   /**************************************************************************
   351    353   ** Interface to code in fts5_hash.c. 

Changes to ext/fts5/fts5_index.c.

  4363   4363         sqlite3_blob_write(pBlob, aCookie, 4, 0);
  4364   4364         rc = sqlite3_blob_close(pBlob);
  4365   4365       }
  4366   4366     }
  4367   4367   
  4368   4368     return rc;
  4369   4369   }
         4370  +
         4371  +int sqlite3Fts5IndexLoadConfig(Fts5Index *p){
         4372  +  Fts5Structure *pStruct;
         4373  +  pStruct = fts5StructureRead(p, 0);
         4374  +  fts5StructureRelease(pStruct);
         4375  +  return fts5IndexReturn(p);
         4376  +}
  4370   4377   
  4371   4378   /*************************************************************************
  4372   4379   **************************************************************************
  4373   4380   ** Below this point is the implementation of the fts5_decode() scalar
  4374   4381   ** function only.
  4375   4382   */
  4376   4383   

Changes to ext/fts5/tool/loadfts5.tcl.

    20     20     }
    21     21   }
    22     22   
    23     23   proc usage {} {
    24     24     puts stderr "Usage: $::argv0 ?SWITCHES? DATABASE PATH"
    25     25     puts stderr ""
    26     26     puts stderr "Switches are:"
    27         -  puts stderr "  -fts4     (use fts4 instead of fts5)"
           27  +  puts stderr "  -fts4        (use fts4 instead of fts5)"
           28  +  puts stderr "  -fts5        (use fts5)"
           29  +  puts stderr "  -porter      (use porter tokenizer)"
           30  +  puts stderr "  -limit N     (load no more than N documents)"
           31  +  puts stderr "  -automerge N (set the automerge parameter to N)"
    28     32     exit 1
    29     33   }
    30     34   
    31         -set O(vtab)   fts5
    32         -set O(tok)    ""
    33         -set O(limit)  0
           35  +set O(vtab)       fts5
           36  +set O(tok)        ""
           37  +set O(limit)      0
           38  +set O(automerge)  -1
    34     39   
    35     40   if {[llength $argv]<2} usage
    36         -for {set i 0} {$i < [llength $argv]-2} {incr i} {
           41  +set nOpt [expr {[llength $argv]-2}]
           42  +for {set i 0} {$i < $nOpt} {incr i} {
    37     43     set arg [lindex $argv $i]
    38     44     switch -- [lindex $argv $i] {
    39     45       -fts4 {
    40     46         set O(vtab) fts4
    41     47       }
    42     48   
    43     49       -fts5 {
................................................................................
    45     51       }
    46     52   
    47     53       -porter {
    48     54         set O(tok) ", tokenize=porter"
    49     55       }
    50     56   
    51     57       -limit {
    52         -      incr i
           58  +      if { [incr i]>=$nOpt } usage
    53     59         set O(limit) [lindex $argv $i]
    54     60       }
           61  +    
           62  +    -automerge {
           63  +      if { [incr i]>=$nOpt } usage
           64  +      set O(automerge) [lindex $argv $i]
           65  +    }
    55     66   
    56     67       default {
    57     68         usage
    58     69       }
    59     70     }
    60     71   }
    61     72   
    62     73   sqlite3 db [lindex $argv end-1]
    63     74   db func loadfile loadfile
    64     75   
    65     76   db transaction {
    66     77     db eval "CREATE VIRTUAL TABLE t1 USING $O(vtab) (path, content$O(tok))"
           78  +  if {$O(automerge)>=0} {
           79  +    if {$O(vtab) == "fts5"} {
           80  +      db eval { INSERT INTO t1(t1, rank) VALUES('automerge', $O(automerge)) }
           81  +    } else {
           82  +      db eval { INSERT INTO t1(t1) VALUES('automerge=' || $O(automerge)) }
           83  +    }
           84  +  }
    67     85     load_hierachy [lindex $argv end]
    68     86   }
    69     87   
    70     88   
    71     89