Example #1
0
 /**
  * Look for any holdings data in the cache and add it to results
  */
 public function injectHoldings()
 {
     // get the record ids for all search results
     $ids = $this->extractRecordIDs();
     // only if there are actually records here
     if (count($ids) > 0) {
         // prefix the engine id
         for ($x = 0; $x < count($ids); $x++) {
             $ids[$x] = $this->config->getID() . "." . $ids[$x];
         }
         // look for any of our items
         $cache = new Cache();
         $cache_array = $cache->get($ids);
         foreach ($cache_array as $id => $holdings) {
             if (!$holdings instanceof Holdings) {
                 continue;
                 // skip it
             }
             // now associate this item with its corresponding result
             for ($x = 0; $x < count($this->records); $x++) {
                 $search_result = $this->records[$x];
                 if ($this->config->getID() . "." . $search_result->xerxes_record->getRecordID() == $id) {
                     $search_result->setHoldings($holdings);
                 }
                 $this->records[$x] = $search_result;
             }
         }
     }
 }