Changed $doc->id to $doc->docid to prevent clashes with Zend Search's internal
[moodle.git] / search / documents / document.php
CommitLineData
682d4032 1<?php
abb4ea20 2 /* Base search document from which other module/block types can
3 * extend.
4 * */
682d4032 5
b585dc5f 6 abstract class SearchDocument extends Zend_Search_Lucene_Document {
a25a3912 7 public function __construct(&$doc, &$data, $document_type, $course_id, $group_id) {
fef0afe1 8 $this->addField(Zend_Search_Lucene_Field::Keyword('docid', $doc->docid));
a25a3912 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));
682d4032 19 } //constructor
20 } //SearchDocument
21
22?>