Improved std. fallback sql.

This commit is contained in:
Martin Edenhofer 2014-02-11 14:09:23 +01:00
parent 9d0937715d
commit 1a64256546
3 changed files with 6 additions and 2 deletions

View file

@ -39,7 +39,8 @@ returns
end end
# fallback do sql query # fallback do sql query
# do query # - stip out * we already search for *query* -
query.gsub! '*', ''
organizations = Organization.find( organizations = Organization.find(
:all, :all,
:limit => limit, :limit => limit,

View file

@ -85,6 +85,8 @@ returns
end end
# do query # do query
# - stip out * we already search for *query* -
query.gsub! '*', ''
tickets_all = Ticket.select('DISTINCT(tickets.id)'). tickets_all = Ticket.select('DISTINCT(tickets.id)').
where(conditions). where(conditions).
where( '( `tickets`.`title` LIKE ? OR `tickets`.`number` LIKE ? OR `ticket_articles`.`body` LIKE ? OR `ticket_articles`.`from` LIKE ? OR `ticket_articles`.`to` LIKE ? OR `ticket_articles`.`subject` LIKE ?)', "%#{query}%", "%#{query}%", "%#{query}%", "%#{query}%", "%#{query}%", "%#{query}%" ). where( '( `tickets`.`title` LIKE ? OR `tickets`.`number` LIKE ? OR `ticket_articles`.`body` LIKE ? OR `ticket_articles`.`from` LIKE ? OR `ticket_articles`.`to` LIKE ? OR `ticket_articles`.`subject` LIKE ?)', "%#{query}%", "%#{query}%", "%#{query}%", "%#{query}%", "%#{query}%", "%#{query}%" ).

View file

@ -55,7 +55,8 @@ returns
end end
# fallback do sql query # fallback do sql query
# do query # - stip out * we already search for *query* -
query.gsub! '*', ''
users = User.find( users = User.find(
:all, :all,
:limit => limit, :limit => limit,