I have a query for searching most relevant items like this:
select *,((case when title like 'mykeyword' then 3 else 0 end)+
(case when body like 'myKeyword' then 3 else 0 end))
as relevance from content
order by relevance,id desc
However I want to give weight to ID so the most recent items have most relevance score. How Can I set this weight rather than "order by ID desc"?
Edit: My ID Column is auto increment and primary key where some ID may be deleted. So I Can not rely on a linear increment and I can not write a mathematical formula to give normalized weight to ID itself.