Index: third_party/sqlite/src/ext/fts5/test/fts5rank.test |
diff --git a/third_party/sqlite/src/ext/fts5/test/fts5rank.test b/third_party/sqlite/src/ext/fts5/test/fts5rank.test |
index 4961b426058bae383dd071efe2539dadd5b9d4f8..a70c5d68e347ad482325067a903b530741353c0b 100644 |
--- a/third_party/sqlite/src/ext/fts5/test/fts5rank.test |
+++ b/third_party/sqlite/src/ext/fts5/test/fts5rank.test |
@@ -91,7 +91,61 @@ do_test 2.7 { |
} {1 3 2} |
+#-------------------------------------------------------------------------- |
+# At one point there was a problem with queries such as: |
+# |
+# ... MATCH 'x OR y' ORDER BY rank; |
+# |
+# if there were zero occurrences of token 'y' in the dataset. The |
+# following tests verify that that problem has been addressed. |
+# |
+foreach_detail_mode $::testprefix { |
+ do_execsql_test 3.1.0 { |
+ CREATE VIRTUAL TABLE y1 USING fts5(z, detail=%DETAIL%); |
+ INSERT INTO y1 VALUES('test xyz'); |
+ INSERT INTO y1 VALUES('test test xyz test'); |
+ INSERT INTO y1 VALUES('test test xyz'); |
+ } |
+ |
+ do_execsql_test 3.1.1 { |
+ SELECT rowid FROM y1('test OR tset'); |
+ } {1 2 3} |
+ |
+ do_execsql_test 3.1.2 { |
+ SELECT rowid FROM y1('test OR tset') ORDER BY bm25(y1) |
+ } {2 3 1} |
+ |
+ do_execsql_test 3.1.3 { |
+ SELECT rowid FROM y1('test OR tset') ORDER BY +rank |
+ } {2 3 1} |
+ |
+ do_execsql_test 3.1.4 { |
+ SELECT rowid FROM y1('test OR tset') ORDER BY rank |
+ } {2 3 1} |
+ |
+ do_execsql_test 3.1.5 { |
+ SELECT rowid FROM y1('test OR xyz') ORDER BY rank |
+ } {3 2 1} |
+ |
+ |
+ do_execsql_test 3.2.1 { |
+ CREATE VIRTUAL TABLE z1 USING fts5(a, detail=%DETAIL%); |
+ INSERT INTO z1 VALUES('wrinkle in time'); |
+ SELECT * FROM z1 WHERE z1 MATCH 'wrinkle in time OR a wrinkle in time'; |
+ } {{wrinkle in time}} |
+} |
+do_execsql_test 4.1 { |
+ DROP TABLE IF EXISTS VTest; |
+ CREATE virtual TABLE VTest USING FTS5( |
+ Title, AUthor, tokenize ='porter unicode61 remove_diacritics 1', |
+ columnsize='1', detail=full |
+ ); |
+ INSERT INTO VTest (Title, Author) VALUES ('wrinkle in time', 'Bill Smith'); |
+ |
+ SELECT * FROM VTest WHERE |
+ VTest MATCH 'wrinkle in time OR a wrinkle in time' ORDER BY rank; |
+} {{wrinkle in time} {Bill Smith}} |