e9a9766b6496022d60e40090b8a19aa04df18aae
[moodle.git] / search / documents / document.php
1 <?php
2   /* Base search document from which other module/block types can
3    * extend.
4    * */
5   
6   abstract class SearchDocument extends Zend_Search_Lucene_Document {  
7     public function __construct(&$doc, &$data, $document_type, $course_id, $group_id) {      
8       $this->addField(Zend_Search_Lucene_Field::Keyword('id', $doc->id));
9       $this->addField(Zend_Search_Lucene_Field::Text('title', $doc->title));
10       $this->addField(Zend_Search_Lucene_Field::Text('author', $doc->author));
11       $this->addField(Zend_Search_Lucene_Field::UnStored('contents', $doc->contents));
12       $this->addField(Zend_Search_Lucene_Field::UnIndexed('url', $doc->url));
13       
14       $this->addField(Zend_Search_Lucene_Field::Binary('data', serialize($data)));
15       
16       $this->addField(Zend_Search_Lucene_Field::Keyword('doctype', $document_type));
17       $this->addField(Zend_Search_Lucene_Field::Keyword('course_id', $course_id));    
18       $this->addField(Zend_Search_Lucene_Field::Keyword('group_id', $group_id));      
19     } //constructor    
20   } //SearchDocument
21     
22 ?>