Closed annemarie35 closed 9 years ago
Search engine for database can be modify. The sql query looks like (for geosearch) SELECT *, distance FROM (SELECT *, ( 6371 * acos( cos( radians( #{@lat} ) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians(#{@lng}) ) + sin( radians(#{@lat}) ) * sin( radians( latitude ) ) ) ) AS distance FROM job_offers ) AS dt WHERE distance < #{@distance} AND to_tsvector('french', offer_description || ' ' || title) @@ plainto_tsquery('french', '#{job}') ORDER BY publication_date DESC LIMIT #{limit} OFFSET #{bg_offers} ;
SELECT *, distance FROM (SELECT *, ( 6371 * acos( cos( radians( #{@lat} ) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians(#{@lng}) ) + sin( radians(#{@lat}) ) * sin( radians( latitude ) ) ) ) AS distance FROM job_offers ) AS dt WHERE distance < #{@distance} AND to_tsvector('french', offer_description || ' ' || title) @@ plainto_tsquery('french', '#{job}') ORDER BY publication_date DESC LIMIT #{limit} OFFSET #{bg_offers} ;
I choose more recent offers but it could be, job title or anything else (in the case of offers can be seen in a more traditionnal way than the map)
Publication_date !
Search engine for database can be modify. The sql query looks like (for geosearch)
SELECT *, distance FROM (SELECT *, ( 6371 * acos( cos( radians( #{@lat} ) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians(#{@lng}) ) + sin( radians(#{@lat}) ) * sin( radians( latitude ) ) ) ) AS distance FROM job_offers ) AS dt WHERE distance < #{@distance} AND to_tsvector('french', offer_description || ' ' || title) @@ plainto_tsquery('french', '#{job}') ORDER BY publication_date DESC LIMIT #{limit} OFFSET #{bg_offers} ;
I choose more recent offers but it could be, job title or anything else (in the case of offers can be seen in a more traditionnal way than the map)