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
<?php | |
/* | |
Adapted from C function available at http://www.sqlite.org/fts3.html#appendix_a | |
Use like this: | |
$db = new SQLite3('database.db'); | |
$db->createFunction('rank', 'sql_rank'); | |
$db->query('CREATE VIRTUAL TABLE products USING fts4 (id INTEGER, title TEXT, description TEXT);'); | |
$db->query('SELECT * FROM products WHERE products MATCH \'Computer\' ORDER BY rank(matchinfo(products), 0, 1.0, 0.5) DESC;'); |