Changeset 1417


Ignore:
Timestamp:
Sep 26, 2010, 1:37:48 AM (10 years ago)
Author:
teymour
Message:

Ajout des RSS

Location:
cpc/trunk/project/apps/frontend/modules/solr
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • cpc/trunk/project/apps/frontend/modules/solr/actions/actions.class.php

    r1416 r1417  
    6565    //Récupère les résultats auprès de SolR
    6666    $s = new SolrConnector();
    67     $params = array('hl'=>'true', 'fl' => 'id,object_id,object_name', 'hl.fragsize'=>500, "facet"=>"true", "facet.field"=>array("object_name","tag"), "facet.date" => "date", "facet.date.start"=>"2007-05-01T00:00:00Z", "facet.date.end"=>"NOW", "facet.date.gap"=>"+1MONTH", 'fq' => $fq);
     67    $params = array('hl'=>'true', 'fl' => 'id,object_id,object_name,date', 'hl.fragsize'=>500, "facet"=>"true", "facet.field"=>array("object_name","tag"), "facet.date" => "date", "facet.date.start"=>"2007-05-01T00:00:00Z", "facet.date.end"=>"NOW", "facet.date.gap"=>"+1MONTH", 'fq' => $fq);
    6868    $this->sort_type = 'pertinence';
    69     if ($this->sort = $request->getParameter('sort')) {
     69
     70    $this->sort = $request->getParameter('sort');
     71    $date = $request->getParameter('date');
     72    $from = $request->getParameter('from');
     73    $rss = $request->getParameter('rss');
     74
     75    if ($rss) {
     76      $this->setTemplate('rss');
     77      $this->feed = new sfRssFeed();
     78      $this->feed->setLanguage('fr');
     79      $this->sort = 1;
     80      $date = null;
     81      $from = null;
     82    }
     83
     84    if ($this->sort) {
     85      $this->selected['sort'] = 1;
    7086      $params['sort'] = "date desc";
    7187      $this->sort_type = 'date';
    7288    }
    73     if ($date = $request->getParameter('date')) {
     89    if ($date) {
    7490      $dates = explode(',', $date);
    7591      $date = array_pop($dates);
     
    8399      $params['facet.date.gap'] = '+1DAY';
    84100    }else {
    85       if ($from = $request->getParameter('from')) {
     101      if ($from) {
    86102        $to = $request->getParameter('to', 'NOW');
    87103        $query .= ' date:['.$from.' TO '.$to.']';
     
    97113      $res = $this->results['docs'][$i];
    98114      $obj = $res['object'];
    99 
    100115      $this->results['docs'][$i]['link'] = $obj->getLink();
    101116      $this->results['docs'][$i]['photo'] = $this->getPhoto($obj);
     
    103118      $this->results['docs'][$i]['personne'] = $obj->getPersonne();
    104119      $this->results['docs'][$i]['highlighting'] = preg_replace('/^'."$this->results['docs'][$i]['personne']".'/', '', implode('...', $results['highlighting'][$res['id']]['text']));
    105      
    106120    }
    107121    $this->results['end'] = $deb + $nb;
  • cpc/trunk/project/apps/frontend/modules/solr/templates/searchSuccess.php

    r1416 r1417  
    1818<div class="searchbox">
    1919<form>
    20     <input name="search" value="<?php echo htmlentities($query, ENT_QUOTES); ?>" />
     20    <input name="search" value="<?php echo preg_replace('/"/', '&quot;', $query); ?>" />
    2121    <input type="submit" value="Rechercher"/>
    2222</form>
Note: See TracChangeset for help on using the changeset viewer.