Professional Documents
Culture Documents
Kod
Kod
type = {
0: project,
1: document,
2: user
}
select
id as projectId,
null as documentId,
null as userId,
title,
description
0 as type,
case
when title like concat('%', :query, '%') then 1,
when description like concat('%', :qury, '%') then 0.5
else 0
end as rang
from project
where (
title like concat('%', :query, '%') or
description like concat('%', :query, '%')
)
union all
select
null as projectId,
id as doumentId,
null as userId,
title,
content as description,
1 as type,
case
when title like concat('%', :query, '%') then 1,
when content like concat('%', :query, '%') then 0.5
else 0
end as rang
from document
where (
title like concat('%', :query, '%') or
content like concat('%', :query, '%')
)
union all
...users...