3
# The author disclaims copyright to this source code.
5
#*************************************************************************
6
# This file implements regression tests for SQLite library. The focus
7
# of this script is testing handling of edge cases for various doclist
8
# merging functions in the FTS3 module query logic.
10
# $Id: fts3ag.test,v 1.2 2007/11/16 00:23:08 shess Exp $
13
set testdir [file dirname $argv0]
14
source $testdir/tester.tcl
16
# If SQLITE_ENABLE_FTS3 is defined, omit this file.
23
CREATE VIRTUAL TABLE t1 USING fts3(content);
24
INSERT INTO t1 (rowid, content) VALUES(1, 'this is a test');
25
INSERT INTO t1 (rowid, content) VALUES(2, 'also a test');
28
# No hits at all. Returns empty doclists from termSelect().
30
execsql {SELECT rowid FROM t1 WHERE t1 MATCH 'something'}
33
# Empty left in docListExceptMerge().
35
execsql {SELECT rowid FROM t1 WHERE t1 MATCH '-this something'}
38
# Empty right in docListExceptMerge().
40
execsql {SELECT rowid FROM t1 WHERE t1 MATCH 'this -something'}
43
# Empty left in docListPhraseMerge().
45
execsql {SELECT rowid FROM t1 WHERE t1 MATCH '"this something"'}
48
# Empty right in docListPhraseMerge().
50
execsql {SELECT rowid FROM t1 WHERE t1 MATCH '"something is"'}
53
# Empty left in docListOrMerge().
55
execsql {SELECT rowid FROM t1 WHERE t1 MATCH 'something OR this'}
58
# Empty right in docListOrMerge().
60
execsql {SELECT rowid FROM t1 WHERE t1 MATCH 'this OR something'}
63
# Empty left in docListAndMerge().
65
execsql {SELECT rowid FROM t1 WHERE t1 MATCH 'something this'}
68
# Empty right in docListAndMerge().
70
execsql {SELECT rowid FROM t1 WHERE t1 MATCH 'this something'}
73
# No support for all-except queries.
75
catchsql {SELECT rowid FROM t1 WHERE t1 MATCH '-this -something'}
76
} {1 {SQL logic error or missing database}}
78
# Test that docListOrMerge() correctly handles reaching the end of one
79
# doclist before it reaches the end of the other.
81
execsql {SELECT rowid FROM t1 WHERE t1 MATCH 'this OR also'}
84
execsql {SELECT rowid FROM t1 WHERE t1 MATCH 'also OR this'}
87
# Empty left and right in docListOrMerge(). Each term matches neither
88
# row, and when combined there was an assertion failure.
90
execsql {SELECT rowid FROM t1 WHERE t1 MATCH 'something OR nothing'}