d5d63ca6a3
handle lack of hits correctly. (CVS 3485) FossilOrigin-Name: 2cb59033662f25677169e2e63b871fb0a4c10c21
78 lines
2.0 KiB
Plaintext
78 lines
2.0 KiB
Plaintext
# 2006 October 19
|
|
#
|
|
# The author disclaims copyright to this source code.
|
|
#
|
|
#*************************************************************************
|
|
# This file implements regression tests for SQLite library. The focus
|
|
# of this script is testing handling of edge cases for various doclist
|
|
# merging functions in the FTS2 module query logic.
|
|
#
|
|
# $Id: fts2g.test,v 1.1 2006/10/25 20:27:40 shess Exp $
|
|
#
|
|
|
|
set testdir [file dirname $argv0]
|
|
source $testdir/tester.tcl
|
|
|
|
# If SQLITE_ENABLE_FTS2 is defined, omit this file.
|
|
ifcapable !fts2 {
|
|
finish_test
|
|
return
|
|
}
|
|
|
|
db eval {
|
|
CREATE VIRTUAL TABLE t1 USING fts2(content);
|
|
INSERT INTO t1 (rowid, content) VALUES(1, 'this is a test');
|
|
}
|
|
|
|
# No hits at all. Returns empty doclists from termSelect().
|
|
do_test fts2g-1.1 {
|
|
execsql {SELECT rowid FROM t1 WHERE t1 MATCH 'something'}
|
|
} {}
|
|
|
|
# Empty left in docListExceptMerge().
|
|
do_test fts2g-1.2 {
|
|
execsql {SELECT rowid FROM t1 WHERE t1 MATCH '-this something'}
|
|
} {}
|
|
|
|
# Empty right in docListExceptMerge().
|
|
do_test fts2g-1.3 {
|
|
execsql {SELECT rowid FROM t1 WHERE t1 MATCH 'this -something'}
|
|
} {1}
|
|
|
|
# Empty left in docListPhraseMerge().
|
|
do_test fts2g-1.4 {
|
|
execsql {SELECT rowid FROM t1 WHERE t1 MATCH '"this something"'}
|
|
} {}
|
|
|
|
# Empty right in docListPhraseMerge().
|
|
do_test fts2g-1.5 {
|
|
execsql {SELECT rowid FROM t1 WHERE t1 MATCH '"something is"'}
|
|
} {}
|
|
|
|
# Empty left in docListOrMerge().
|
|
do_test fts2g-1.6 {
|
|
execsql {SELECT rowid FROM t1 WHERE t1 MATCH 'something OR this'}
|
|
} {1}
|
|
|
|
# Empty right in docListOrMerge().
|
|
do_test fts2g-1.7 {
|
|
execsql {SELECT rowid FROM t1 WHERE t1 MATCH 'this OR something'}
|
|
} {1}
|
|
|
|
# Empty left in docListAndMerge().
|
|
do_test fts2g-1.8 {
|
|
execsql {SELECT rowid FROM t1 WHERE t1 MATCH 'something this'}
|
|
} {}
|
|
|
|
# Empty right in docListAndMerge().
|
|
do_test fts2g-1.9 {
|
|
execsql {SELECT rowid FROM t1 WHERE t1 MATCH 'this something'}
|
|
} {}
|
|
|
|
# No support for all-except queries.
|
|
do_test fts2g-1.10 {
|
|
catchsql {SELECT rowid FROM t1 WHERE t1 MATCH '-this -something'}
|
|
} {1 {SQL logic error or missing database}}
|
|
|
|
finish_test
|