| Index: third_party/sqlite/src/ext/fts5/test/fts5ah.test
 | 
| diff --git a/third_party/sqlite/src/ext/fts5/test/fts5ah.test b/third_party/sqlite/src/ext/fts5/test/fts5ah.test
 | 
| index 6d7e39f79302bafd94ef68cc8aacc3cbee6998d0..b7beb5655b21e6bea925571815a64b953992b925 100644
 | 
| --- a/third_party/sqlite/src/ext/fts5/test/fts5ah.test
 | 
| +++ b/third_party/sqlite/src/ext/fts5/test/fts5ah.test
 | 
| @@ -21,12 +21,16 @@ ifcapable !fts5 {
 | 
|    return
 | 
|  }
 | 
|  
 | 
| +foreach_detail_mode $testprefix {
 | 
| +
 | 
|  #-------------------------------------------------------------------------
 | 
|  # This file contains tests for very large doclists.
 | 
|  #
 | 
|  
 | 
| +set Y [list]
 | 
| +set W [list]
 | 
|  do_test 1.0 {
 | 
| -  execsql { CREATE VIRTUAL TABLE t1 USING fts5(a) }
 | 
| +  execsql { CREATE VIRTUAL TABLE t1 USING fts5(a, detail=%DETAIL%) }
 | 
|    execsql { INSERT INTO t1(t1, rank) VALUES('pgsz', 128) }
 | 
|    set v {w w w w w w w w w w w w w w w w w w w w}
 | 
|    execsql { INSERT INTO t1(rowid, a) VALUES(0, $v) }
 | 
| @@ -70,7 +74,12 @@ do_test 1.4 {
 | 
|    set nRead [reads]
 | 
|    execsql { SELECT rowid FROM t1 WHERE t1 MATCH 'x' }
 | 
|    set nReadX [expr [reads] - $nRead]
 | 
| -  expr $nReadX>1000
 | 
| +  #puts -nonewline "(nReadX=$nReadX)"
 | 
| +  if {[detail_is_full]} { set expect 1000 }
 | 
| +  if {[detail_is_col]}  { set expect 250 }
 | 
| +  if {[detail_is_none]} { set expect 80 }
 | 
| +
 | 
| +  expr $nReadX>$expect
 | 
|  } {1}
 | 
|  
 | 
|  do_test 1.5 {
 | 
| @@ -87,17 +96,22 @@ foreach {tn q res} "
 | 
|    3 { SELECT rowid FROM t1 WHERE t1 MATCH 'x AND w' }  [list $W]
 | 
|    4 { SELECT rowid FROM t1 WHERE t1 MATCH 'y AND x' }  [list $Y]
 | 
|  " {
 | 
| +  if {[detail_is_full]==0 && ($tn==1 || $tn==2)} continue
 | 
| +
 | 
| +  if {[detail_is_full]} { set ratio 8 }
 | 
| +  if {[detail_is_col]}  { set ratio 4 }
 | 
| +  if {[detail_is_none]} { set ratio 2 }
 | 
|  
 | 
|    do_test 1.6.$tn.1 {
 | 
|      set n [execsql_reads $q]
 | 
|      #puts -nonewline "(n=$n nReadX=$nReadX)"
 | 
| -    expr {$n < ($nReadX / 8)}
 | 
| +    expr {$n < ($nReadX / $ratio)}
 | 
|    } {1}
 | 
|  
 | 
|    do_test 1.6.$tn.2 {
 | 
|      set n [execsql_reads "$q ORDER BY rowid DESC"]
 | 
|      #puts -nonewline "(n=$n nReadX=$nReadX)"
 | 
| -    expr {$n < ($nReadX / 8)}
 | 
| +    expr {$n < ($nReadX / $ratio)}
 | 
|    } {1}
 | 
|  
 | 
|    do_execsql_test 1.6.$tn.3 $q [lsort -int -incr $res]
 | 
| @@ -109,21 +123,26 @@ foreach {tn q res} "
 | 
|  # number of pages loaded from disk.
 | 
|  #
 | 
|  foreach {tn fraction tail cnt} {
 | 
| -  1 0.6 {rowid > 5000} 5000
 | 
| -  2 0.2 {rowid > 9000} 1000
 | 
| -  3 0.2 {rowid < 1000}  999
 | 
| -  4 0.2 {rowid BETWEEN 4000 AND 5000}  1001
 | 
| -  5 0.6 {rowid >= 5000} 5001
 | 
| -  6 0.2 {rowid >= 9000} 1001
 | 
| -  7 0.2 {rowid <= 1000} 1000
 | 
| -  8 0.6 {rowid > '5000'} 5000
 | 
| -  9 0.2 {rowid > '9000'} 1000
 | 
| +  1  0.6 {rowid > 5000} 5000
 | 
| +  2  0.2 {rowid > 9000} 1000
 | 
| +  3  0.2 {rowid < 1000}  999
 | 
| +  4  0.2 {rowid BETWEEN 4000 AND 5000}  1001
 | 
| +  5  0.6 {rowid >= 5000} 5001
 | 
| +  6  0.2 {rowid >= 9000} 1001
 | 
| +  7  0.2 {rowid <= 1000} 1000
 | 
| +  8  0.6 {rowid > '5000'} 5000
 | 
| +  9  0.2 {rowid > '9000'} 1000
 | 
|    10 0.1 {rowid = 444} 1
 | 
|  } {
 | 
|    set q "SELECT rowid FROM t1 WHERE t1 MATCH 'x' AND $tail"
 | 
|    set n [execsql_reads $q]
 | 
|    set ret [llength [execsql $q]]
 | 
|  
 | 
| +  # Because the position lists for 'x' are quite long in this db, the 
 | 
| +  # advantage is a bit smaller in detail=none mode. Update $fraction to 
 | 
| +  # reflect this.
 | 
| +  if {[detail_is_none] && $fraction<0.5} { set fraction [expr $fraction*2] }
 | 
| +
 | 
|    do_test "1.7.$tn.asc.(n=$n ret=$ret)" {
 | 
|      expr {$n < ($fraction*$nReadX) && $ret==$cnt}
 | 
|    } {1}
 | 
| @@ -143,6 +162,7 @@ do_execsql_test 1.8.2 {
 | 
|    SELECT count(*) FROM t1 WHERE t1 MATCH 'x' AND rowid < 'text';
 | 
|  } {10000}
 | 
|  
 | 
| +} ;# foreach_detail_mode
 | 
|  
 | 
|  #db eval {SELECT rowid, fts5_decode(rowid, block) aS r FROM t1_data} {puts $r}
 | 
|  
 | 
| 
 |