Ignore:
Timestamp:
Sep 7, 2010, 12:43:31 AM (11 years ago)
Author:
teymour
Message:

Permettre la connexion avec solr pas totalement identique à la base locale

File:
1 edited

Legend:

Unmodified
Added
Removed
  • cpc/trunk/project/lib/model/solr/SolrConnector.class.php

    r1327 r1330  
    8585    $response = $this->solr->search($queryString, $offset, $maxHits, $params);
    8686    $results = unserialize($response->getRawResponse());
     87    $unset = array();
    8788    for ($i = 0 ; $i < count($results['response']['docs']); $i++) {
    8889      $res = $results['response']['docs'][$i];
    8990      $results['response']['docs'][$i]['object'] = Doctrine::getTable($res['object_name'])->find($res['object_id']);
     91      if (!$results['response']['docs'][$i]['object'])
     92        $unset[] = $i;
    9093    }
     94    foreach ($unset as $i) {
     95      unset($results['response']['docs'][$i]);
     96    }
     97    $results['response']['docs'] = array_values($results['response']['docs']);
    9198    return $results;
    9299  }
Note: See TracChangeset for help on using the changeset viewer.