1<?php 2/** 3 * 4 * @package solr 5 * @author Gabriel Birke <birke@d-scribe.de> 6 * @license GPL 2 (http://www.gnu.org/licenses/gpl.html) 7 */ 8 9/** 10 * This class gathers field information 11 */ 12class Solr_Pageinfo { 13 14 protected $id; 15 protected $writer; 16 17 public function __construct($id){ 18 $this->id = $id; 19 } 20 21 public function getFields(){ 22 $fields = array( 23 'id' => $this->id, 24 'content' => rawWiki($this->id) 25 ); 26 $meta = p_get_metadata($this->id, '', true); 27 $fields['created'] = date('Y-m-d\TH:i:s\Z', $meta['date']['created']); 28 $fields['modified'] = date('Y-m-d\TH:i:s\Z', $meta['date']['modified']); 29 $fields['creator'] = $meta['creator']; 30 $fields['title'] = $meta['title']; 31 $fields['abstract'] = $meta['description']['abstract']; 32 if(!empty($meta['contributor'])) { 33 foreach($meta['contributor'] as $name) { 34 if($name) { 35 $fields['contributor'][] = $name; 36 } 37 } 38 } 39 if(!empty($meta['relation']['references'])) { 40 foreach($meta['relation']['references'] as $id => $num_ref) { 41 if($id) { 42 $fields['references'][] = $id; 43 } 44 } 45 } 46 trigger_event('SOLR_INDEX_FIELDS', $fields); 47 return $fields; 48 } 49 50} 51