Created
October 18, 2010 16:32
-
-
Save nickdunn/632526 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
SELECT | |
SQL_CALC_FOUND_ROWS | |
e.id as `entry_id`, | |
data, | |
e.section_id as `section_id`, | |
UNIX_TIMESTAMP(e.creation_date) AS `creation_date`, | |
( | |
MATCH(index.data) AGAINST ('data \"source chaining\"') * | |
CASE | |
WHEN e.section_id = 61 THEN 4 | |
WHEN e.section_id = 50 THEN 2 | |
WHEN e.section_id = 42 THEN 2 | |
WHEN e.section_id = 46 THEN 2 | |
WHEN e.section_id = 39 THEN 0 | |
WHEN e.section_id = 67 THEN 2 | |
WHEN e.section_id = 54 THEN 2 | |
WHEN e.section_id = 63 THEN 2 | |
WHEN e.section_id = 59 THEN 2 | |
WHEN e.section_id = 60 THEN 2 | |
WHEN e.section_id = 58 THEN 4 | |
ELSE 1 | |
END | |
/ SQRT(GREATEST(1, DATEDIFF(NOW(), creation_date))) | |
) AS `score` | |
FROM | |
sym_search_index as `index` | |
JOIN sym_entries as `e` ON (index.entry_id = e.id) | |
WHERE | |
MATCH(index.data) AGAINST ('+\"data\" +\"source chaining\" +\"\"' IN BOOLEAN MODE) | |
AND e.section_id IN ('61','50','39','58','54','42','38','63','67','46','59','60') | |
ORDER BY | |
score desc | |
LIMIT 0, 20 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment