1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-11-14 00:22:38 +03:00

Add a %_config table to fts5.

FossilOrigin-Name: 83491c56661ca78f96020ba68184bb3fb19e674f
This commit is contained in:
dan
2014-11-27 20:03:45 +00:00
parent cb62aae034
commit cb11e73fc2
17 changed files with 287 additions and 128 deletions

View File

@@ -30,6 +30,7 @@ do_execsql_test 1.0 {
t1_data {CREATE TABLE 't1_data'(id INTEGER PRIMARY KEY, block BLOB)}
t1_content {CREATE TABLE 't1_content'(id INTEGER PRIMARY KEY, c0, c1, c2)}
t1_docsize {CREATE TABLE 't1_docsize'(id INTEGER PRIMARY KEY, sz BLOB)}
t1_config {CREATE TABLE 't1_config'(k PRIMARY KEY, v) WITHOUT ROWID}
}
do_execsql_test 1.1 {
@@ -84,7 +85,7 @@ foreach {i x y} {
reset_db
do_execsql_test 4.0 {
CREATE VIRTUAL TABLE t1 USING fts5(x,y);
INSERT INTO t1(t1) VALUES('pgsz=32');
INSERT INTO t1(t1, rowid) VALUES('pgsz', 32);
}
foreach {i x y} {
1 {g f d b f} {h h e i a}
@@ -108,7 +109,7 @@ foreach {i x y} {
reset_db
do_execsql_test 5.0 {
CREATE VIRTUAL TABLE t1 USING fts5(x,y);
INSERT INTO t1(t1) VALUES('pgsz=32');
INSERT INTO t1(t1, rowid) VALUES('pgsz', 32);
}
foreach {i x y} {
1 {dd abc abc abc abcde} {aaa dd ddd ddd aab}
@@ -133,7 +134,7 @@ breakpoint
reset_db
do_execsql_test 6.0 {
CREATE VIRTUAL TABLE t1 USING fts5(x,y);
INSERT INTO t1(t1) VALUES('pgsz=32');
INSERT INTO t1(t1, rowid) VALUES('pgsz', 32);
}
do_execsql_test 6.1 {
@@ -151,7 +152,7 @@ reset_db
expr srand(0)
do_execsql_test 7.0 {
CREATE VIRTUAL TABLE t1 USING fts5(x,y,z);
INSERT INTO t1(t1) VALUES('pgsz=32');
INSERT INTO t1(t1, rowid) VALUES('pgsz', 32);
}
proc doc {} {
@@ -190,7 +191,7 @@ for {set i 1} {$i <= 10} {incr i} {
reset_db
do_execsql_test 8.0 {
CREATE VIRTUAL TABLE t1 USING fts5(x, prefix="1,2,3");
INSERT INTO t1(t1) VALUES('pgsz=32');
INSERT INTO t1(t1, rowid) VALUES('pgsz', 32);
}
do_execsql_test 8.1 {
@@ -207,7 +208,7 @@ expr srand(0)
do_execsql_test 9.0 {
CREATE VIRTUAL TABLE t1 USING fts5(x,y,z, prefix="1,2,3");
INSERT INTO t1(t1) VALUES('pgsz=32');
INSERT INTO t1(t1, rowid) VALUES('pgsz', 32);
}
proc doc {} {

View File

@@ -59,7 +59,7 @@ do_execsql_test 1.6 {
reset_db
do_execsql_test 2.1 {
CREATE VIRTUAL TABLE t1 USING fts5(x);
INSERT INTO t1(t1) VALUES('pgsz=32');
INSERT INTO t1(t1, rowid) VALUES('pgsz', 32);
INSERT INTO t1 VALUES('one');
INSERT INTO t1 VALUES('two');
INSERT INTO t1 VALUES('three');
@@ -99,7 +99,7 @@ foreach {tn expr res} {
reset_db
do_execsql_test 3.0 {
CREATE VIRTUAL TABLE t1 USING fts5(a,b);
INSERT INTO t1(t1) VALUES('pgsz=32');
INSERT INTO t1(t1, rowid) VALUES('pgsz', 32);
}
foreach {tn a b} {

View File

@@ -25,7 +25,7 @@ ifcapable !fts5 {
do_execsql_test 1.0 {
CREATE VIRTUAL TABLE xx USING fts5(x,y);
INSERT INTO xx(xx) VALUES('pgsz=32');
INSERT INTO xx(xx, rowid) VALUES('pgsz', 32);
}
set data {

View File

@@ -55,12 +55,12 @@ foreach {tn match res} {
foreach {T create} {
2 {
CREATE VIRTUAL TABLE t1 USING fts5(a, b);
INSERT INTO t1(t1) VALUES('pgsz=32');
INSERT INTO t1(t1, rowid) VALUES('pgsz', 32);
}
3 {
CREATE VIRTUAL TABLE t1 USING fts5(a, b, prefix=1,2,3,4,5);
INSERT INTO t1(t1) VALUES('pgsz=32');
INSERT INTO t1(t1, rowid) VALUES('pgsz', 32);
}
} {

View File

@@ -25,7 +25,7 @@ ifcapable !fts5 {
do_execsql_test 1.0 {
CREATE VIRTUAL TABLE t1 USING fts5(a, b);
INSERT INTO t1(t1) VALUES('pgsz=32');
INSERT INTO t1(t1, rowid) VALUES('pgsz', 32);
}
do_execsql_test 1.1 {

View File

@@ -28,7 +28,7 @@ ifcapable !fts5 {
do_test 1.0 {
execsql { CREATE VIRTUAL TABLE t1 USING fts5(a) }
execsql { INSERT INTO t1(t1) VALUES('pgsz=128') }
execsql { INSERT INTO t1(t1, rowid) VALUES('pgsz', 128) }
for {set i 1} {$i <= 10000} {incr i} {
set v {x x x x x x x x x x x x x x x x x x x x}
if {($i % 2139)==0} {lset v 3 Y ; lappend Y $i}

View File

@@ -46,7 +46,7 @@ proc structure {} {
expr srand(0)
do_execsql_test 1.0 {
CREATE VIRTUAL TABLE t1 USING fts5(x);
INSERT INTO t1(t1) VALUES('pgsz=64');
INSERT INTO t1(t1, rowid) VALUES('pgsz', 64);
}
for {set iTest 0} {$iTest < 50000} {incr iTest} {

View File

@@ -106,6 +106,18 @@ do_execsql_test 2.5 {
{a [b c d e] f g h i j}
}
do_execsql_test 2.6.1 {
SELECT highlight(ft2, 0, '[', ']') FROM ft2 WHERE ft2 MATCH 'f d'
} {
{a b c [d] e [f] g h i j}
}
do_execsql_test 2.6.2 {
SELECT highlight(ft2, 0, '[', ']') FROM ft2 WHERE ft2 MATCH 'd f'
} {
{a b c [d] e [f] g h i j}
}
finish_test

43
test/fts5al.test Normal file
View File

@@ -0,0 +1,43 @@
# 2014 November 24
#
# The author disclaims copyright to this source code. In place of
# a legal notice, here is a blessing:
#
# May you do good and not evil.
# May you find forgiveness for yourself and forgive others.
# May you share freely, never taking more than you give.
#
#*************************************************************************
# This file implements regression tests for SQLite library. The
# focus of this script is testing the FTS5 module.
#
# Specifically, this function tests the %_config table.
#
set testdir [file dirname $argv0]
source $testdir/tester.tcl
set testprefix fts5al
# If SQLITE_ENABLE_FTS5 is defined, omit this file.
ifcapable !fts5 {
finish_test
return
}
do_execsql_test 1.1 {
CREATE VIRTUAL TABLE ft1 USING fts5(x);
SELECT * FROM ft1_config;
} {}
do_execsql_test 1.2 {
INSERT INTO ft1(ft1, rank) VALUES('pgsz', 32);
SELECT * FROM ft1_config;
} {pgsz 32}
do_execsql_test 1.3 {
INSERT INTO ft1(ft1, rank) VALUES('pgsz', 64);
SELECT * FROM ft1_config;
} {pgsz 64}
finish_test