/* getAll 1 (busqueda) - getAll - http://www.casinuevo.net/camas-y-colchones.html */ SELECT l.nombre localidad_nombre,l.url_nombre localidad_nombre_url, a.*,u.tienda,u.facebook_uid,u.tlf_verificado,u.telefono , (+IF(LOWER(a.keywords_busqueda) like LOWER('%camas%') OR LOWER('camas%') OR LOWER('%camas'),1,0) +IF(LOWER(a.keywords_busqueda) like LOWER('%cama%') OR LOWER('cama%') OR LOWER('%cama'),1,0) +IF(LOWER(a.nombre) like LOWER('%cama%') OR LOWER('cama%') OR LOWER('%cama'),1,0) +IF(LOWER(a.nombre) like LOWER('%camas%') OR LOWER('camas%') OR LOWER('%camas'),1,0) +IF(LOWER(a.nombre) like LOWER('%camas%') OR LOWER('camas%') OR LOWER('%camas'),1,0) +IF(LOWER(a.keywords_busqueda) like LOWER('%camas colchones%') OR LOWER('camas colchones%') OR LOWER('%camas colchones'),1,0) +IF(LOWER(a.keywords_busqueda) like LOWER('%colchon%') OR LOWER('colchon%') OR LOWER('%colchon'),1,0) +IF(LOWER(a.nombre) like LOWER('%colchon%') OR LOWER('colchon%') OR LOWER('%colchon'),1,0) +IF(LOWER(a.nombre) like LOWER('%colchones%') OR LOWER('colchones%') OR LOWER('%colchones'),1,0) +IF(LOWER(a.nombre) like LOWER('%camas colchones%') OR LOWER('camas colchones%') OR LOWER('%camas colchones'),1,0) +IF(patrocinado1 IS NOT NULL OR patrocinado2 IS NOT NULL,5,0) -IF(LENGTH(a.descript)>2200,2,0) ) as rank FROM anuncios a LEFT JOIN localidades l ON a.id_localidad = l.id INNER JOIN usuarios u ON u.id = a.id_usuario WHERE 1 AND id_subcategoria != 0 AND website = 'C' AND a.id_categoria !=321 AND id_subcategoria != '330' AND id_subcategoria != '260' AND (MATCH (a.keywords_busqueda) AGAINST ('+camas +colchones' IN BOOLEAN MODE)) order by rank desc, modificado desc LIMIT 0 , 30