One liner without any extra conditions, just pure ordering:
product.order("FIELD(product,'dxxx') desc, product").map { |p| [p.product, p.id, {title: p.product}] }
More about order by FIELD syntax here: http://www.electrictoolbox.com/mysql-order-specific-field-values/