Changeset 1578


Ignore:
Timestamp:
Oct 3, 2010, 5:44:01 PM (10 years ago)
Author:
teymour
Message:

résolution du bug solr avec les dates positionnées à minuit

File:
1 edited

Legend:

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

    r1552 r1578  
    6868    }
    6969    //Récupère les résultats auprès de SolR
    70     $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);
     70    $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, "facet.date.include" => "edge");
    7171    $this->sort_type = 'pertinence';
    7272
     
    121121    $this->vue = 'par_mois';
    122122   
     123    $period = '';
     124
    123125    if ($date) {
    124126      $this->selected['date'][$date] = $date;
     
    155157      }
    156158     
     159      if ($period == 'DAY') {
     160        $from = date ('Y-m-d', strtotime($from)-(3600*2+1)).'T23:59:59Z';
     161      }
     162
    157163      $query .= ' date:['.$from.' TO '.$to.']';
    158164      $params['facet.date.start'] = $from;
     
    162168   
    163169    $this->start = $params['facet.date.start'];
     170    if ($period == 'DAY') {
     171      $this->start = date ('Y-m-d', strtotime($this->start)+1).'T00:00:00Z';
     172    }
    164173    $this->end = $params['facet.date.end'];
    165174
     
    233242    $this->fdates['max'] = 1;
    234243    foreach($results['facet_counts']['facet_dates']['date'] as $date => $nb) {
     244      if ($period == 'DAY') {
     245        $date = date ('Y-m-d', strtotime($date)+1).'T00:00:00Z';     
     246      }
    235247      if (preg_match('/^20/', $date)) {
    236248        $pc = $nb/$results['response']['numFound'];
Note: See TracChangeset for help on using the changeset viewer.