-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
updated function for weighted columns
- Loading branch information
AJ ONeal
committed
Jul 26, 2012
1 parent
af4e526
commit d3b9595
Showing
2 changed files
with
48 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
.load fts4-rank.sqlext | ||
|
||
-- This example (and all others in this section) assumes the following schema | ||
CREATE VIRTUAL TABLE documents USING fts4(title, content); | ||
|
||
INSERT INTO documents VALUES('hello world', 'This message is a hello world message.'); | ||
INSERT INTO documents VALUES('urgent: serious', 'This mail is seen as a more serious mail'); | ||
|
||
SELECT title FROM documents WHERE documents MATCH 'message'; | ||
|
||
-- result should be 3.0 | ||
SELECT rank(matchinfo(documents)) AS rank | ||
FROM documents | ||
WHERE documents MATCH '"serious OR mail"' | ||
ORDER BY rank DESC | ||
LIMIT 10 OFFSET 0; | ||
|
||
-- result should be 2.0 | ||
SELECT rank(matchinfo(documents), 2.0) AS rank | ||
FROM documents | ||
WHERE documents MATCH '"serious OR mail"' | ||
ORDER BY rank DESC | ||
LIMIT 10 OFFSET 0; | ||
|
||
-- result should be 1.0 | ||
SELECT rank(matchinfo(documents), 0.0, 0.5) AS rank | ||
FROM documents | ||
WHERE documents MATCH '"serious OR mail"' | ||
ORDER BY rank DESC | ||
LIMIT 10 OFFSET 0; | ||
|
||
-- result should be 3.8 | ||
SELECT rank(matchinfo(documents), 1.2, 1.3) AS rank | ||
FROM documents | ||
WHERE documents MATCH '"serious OR mail"' | ||
ORDER BY rank DESC | ||
LIMIT 10 OFFSET 0; | ||
|
||
/* should fail */ | ||
SELECT rank(matchinfo(documents), 0.0, 0.0, 1.7) AS rank | ||
FROM documents | ||
WHERE documents MATCH '"serious OR mail"' | ||
ORDER BY rank DESC | ||
LIMIT 10 OFFSET 0; |