/ Check-in [da7abe05]
Login
SQLite training in Houston TX on 2019-11-05 (details)
Part of the 2019 Tcl Conference

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

Overview
Comment:Fix some matchinfo related test problems in fts3rnd.test.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: da7abe05887d1ad52552d8ce3a153a0a76f96c5a
User & Date: dan 2010-01-14 11:17:05
Context
2010-01-14
11:45
Add a test to e_fts3.test for the matchinfo example in fts3.html. check-in: e5336edc user: dan tags: trunk
11:17
Fix some matchinfo related test problems in fts3rnd.test. check-in: da7abe05 user: dan tags: trunk
00:39
Comment cleanup in sqliteInt.h. check-in: 67c3aea5 user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to test/fts3rnd.test.

   155    155       }
   156    156     }
   157    157   
   158    158     #lsort -uniq -integer $ret
   159    159     set ret
   160    160   }
   161    161   
          162  +# This [proc] is used to test the FTS3 matchinfo() function.
          163  +# 
   162    164   proc simple_token_matchinfo {zToken} {
   163         -  set total(0) 0
   164         -  set total(1) 0
   165         -  set total(2) 0
   166    165   
   167         -  foreach key [lsort -integer [array names ::t1]] {
          166  +  set nDoc(0) 0
          167  +  set nDoc(1) 0
          168  +  set nDoc(2) 0
          169  +  set nHit(0) 0
          170  +  set nHit(1) 0
          171  +  set nHit(2) 0
          172  +
          173  +
          174  +  foreach key [array names ::t1] {
   168    175       set value $::t1($key)
   169         -    set cnt [list]
          176  +    set a($key) [list]
   170    177       foreach i {0 1 2} col $value {
   171         -      set n [llength [lsearch -all $col $zToken]]
   172         -      lappend cnt $n
   173         -      incr total($i) $n
          178  +      set hit [llength [lsearch -all $col $zToken]]
          179  +      lappend a($key) $hit
          180  +      incr nHit($i) $hit
          181  +      if {$hit>0} { incr nDoc($i) }
   174    182       }
   175         -    if {[lindex [lsort $cnt] end]} {
   176         -      lappend ret $key [concat 1 3 XXX $cnt]
          183  +  }
          184  +
          185  +  set ret [list]
          186  +  foreach docid [lsort -integer [array names a]] {
          187  +    if { [lindex [lsort -integer $a($docid)] end] } {
          188  +      set matchinfo [list 1 3]
          189  +      foreach i {0 1 2} hit $a($docid) {
          190  +        lappend matchinfo $hit $nHit($i) $nDoc($i)
          191  +      }
          192  +      lappend ret $docid $matchinfo
   177    193       }
   178    194     }
   179         -  
   180         -  string map [list XXX "$total(0) $total(1) $total(2)"] $ret
          195  +
          196  +  set ret
   181    197   } 
   182    198   
   183    199   proc simple_near {termlist nNear} {
   184    200     set ret [list]
   185    201   
   186    202     foreach {key value} [array get ::t1] {
   187    203       foreach v $value {