aboutsummaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
Diffstat (limited to 'ext')
-rw-r--r--ext/fts5/fts5_index.c7
-rw-r--r--ext/fts5/test/fts5contentless5.test56
2 files changed, 60 insertions, 3 deletions
diff --git a/ext/fts5/fts5_index.c b/ext/fts5/fts5_index.c
index 4363305a5..a51ae19e7 100644
--- a/ext/fts5/fts5_index.c
+++ b/ext/fts5/fts5_index.c
@@ -4889,6 +4889,11 @@ static int fts5IndexFindDeleteMerge(Fts5Index *p, Fts5Structure *pStruct){
nBest = nPercent;
}
}
+
+ /* If pLvl is already the input level to an ongoing merge, look no
+ ** further for a merge candidate. The caller should be allowed to
+ ** continue merging from pLvl first. */
+ if( pLvl->nMerge ) break;
}
}
return iRet;
@@ -8813,7 +8818,7 @@ static int fts5structConnectMethod(
/*
** We must have a single struct=? constraint that will be passed through
-** into the xFilter method. If there is no valid stmt=? constraint,
+** into the xFilter method. If there is no valid struct=? constraint,
** then return an SQLITE_CONSTRAINT error.
*/
static int fts5structBestIndexMethod(
diff --git a/ext/fts5/test/fts5contentless5.test b/ext/fts5/test/fts5contentless5.test
index 356367886..86d075328 100644
--- a/ext/fts5/test/fts5contentless5.test
+++ b/ext/fts5/test/fts5contentless5.test
@@ -35,8 +35,8 @@ do_execsql_test 1.01 {
}
# explain_i "UPDATE t1 SET a='a' WHERE t1.rowid=1"
-breakpoint
-explain_i "UPDATE t1 SET a='a' FROM t2 WHERE t1.rowid=1 AND b IS NULL"
+#breakpoint
+#explain_i "UPDATE t1 SET a='a' FROM t2 WHERE t1.rowid=1 AND b IS NULL"
#breakpoint
#explain_i "UPDATE t1 SET a='a' WHERE b IS NULL AND rowid=?"
@@ -56,4 +56,56 @@ foreach {tn up err} {
do_catchsql_test 1.$tn $up $res($err)
}
+#-------------------------------------------------------------------------
+reset_db
+
+proc random {n} { expr {abs(int(rand()*$n))} }
+proc select_one {list} {
+ set n [llength $list]
+ lindex $list [random $n]
+}
+proc vocab {} {
+ list abc def ghi jkl mno pqr stu vwx yza
+}
+proc term {} {
+ select_one [vocab]
+}
+proc document {} {
+ set nTerm [expr [random 3] + 7]
+ set doc ""
+ for {set ii 0} {$ii < $nTerm} {incr ii} {
+ lappend doc [term]
+ }
+ set doc
+}
+db func document document
+
+do_execsql_test 2.0 {
+ CREATE VIRTUAL TABLE ft USING fts5(a, contentless_delete=1, content='');
+ INSERT INTO ft(ft, rank) VALUES('pgsz', 64);
+}
+
+do_test 2.1 {
+ for {set ii 1} {$ii < 12} {incr ii} {
+ db transaction {
+ for {set jj 0} {$jj < 10} {incr jj} {
+ set doc [document]
+ execsql { INSERT INTO ft VALUES($doc); }
+ }
+ }
+ }
+} {}
+
+do_test 2.2 {
+ foreach r [db eval {SELECT rowid FROM ft}] {
+ execsql { DELETE FROM ft WHERE rowid=$r }
+ }
+} {}
+
+set doc [document]
+do_execsql_test 2.3 {
+ INSERT INTO ft VALUES($doc)
+}
+
+
finish_test