Date field added to documents.

This commit is contained in:
mchampan 2006-08-16 13:31:55 +00:00
parent b3e900cee6
commit ecebdf0e6e
7 changed files with 27 additions and 4 deletions

View File

@ -1,10 +1,12 @@
CREATE TABLE IF NOT EXISTS `prefix_search_documents` (
`id` int(11) NOT NULL auto_increment,
`docid` int(11) NOT NULL,
`doctype` varchar(12) NOT NULL default 'none',
`title` varchar(100) NOT NULL default '',
`url` varchar(100) NOT NULL default '',
`docdate` timestamp NOT NULL default '0',
`updated` timestamp NOT NULL default CURRENT_TIMESTAMP,
`courseid` int(11) NOT NULL default '0',
`groupid` int(11) NOT NULL default '0',
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=1;
) ENGINE=MyISAM AUTO_INCREMENT=1;

View File

@ -1,9 +1,11 @@
CREATE TABLE prefix_search_documents (
id SERIAL8 PRIMARY KEY,
docid int4 NOT NULL,
doctype varchar(12) NOT NULL DEFAULT 'none',
title varchar(100) NOT NULL default '',
url varchar(100) NOT NULL default '',
docdate timestamp NOT NULL,
updated timestamp NOT NULL DEFAULT NOW(),
courseid int4,
groupid int4
);
);

View File

@ -10,6 +10,7 @@
$this->addField(Zend_Search_Lucene_Field::Text('author', $doc->author));
$this->addField(Zend_Search_Lucene_Field::UnStored('contents', $doc->contents));
$this->addField(Zend_Search_Lucene_Field::UnIndexed('url', $doc->url));
$this->addField(Zend_Search_Lucene_Field::UnIndexed('date', $doc->date));
$this->addField(Zend_Search_Lucene_Field::Binary('data', serialize($data)));

View File

@ -12,6 +12,7 @@
$doc->title = $post['subject'];
$doc->author = $post['firstname']." ".$post['lastname'];
$doc->contents = $post['message'];
$doc->date = $post['created'];
$doc->url = forum_make_link($post['discussion'], $post['id']);

View File

@ -14,6 +14,7 @@
// generic information; required
$doc->docid = $entry['id'];
$doc->title = $entry['concept'];
$doc->date = $entry['timecreated'];
$user = get_recordset('user', 'id', $entry['userid'])->fields;
@ -38,7 +39,7 @@
//preserve glossary pop-up, be careful where you place your ' and "s
//this function is meant to return a url that is placed between href='[url here]'
return "$CFG->wwwroot/mod/glossary/showentry.php?eid=$entry_id' onclick='return openpopup(\"/mod/glossary/showentry.php?eid=$entry_id\", \"entry\", \"menubar=0,location=0,scrollbars,resizable,width=600,height=450\", 0);";
} //glossary_make_link
} //glossary_make_link
function glossary_iterator() {
return get_all_instances_in_courses("glossary", get_courses());
@ -61,9 +62,23 @@
return $documents;
} //glossary_get_content_for_index
function glossary_single_document($id) {
$entries = get_recordset('glossary_entries', 'id', $id);
$entry = $entries->fields;
$glossaries = get_recordset('glossary', 'id', $entry['glossaryid']);
$glossary = $glossaries->fields;
return new GlossarySearchDocument($entry, $entry['glossaryid'], $glossary['course'], -1);
} //glossary_single_document
function glossary_delete($info) {
return $info;
} //glossary_delete
} //glossary_delete
function glossary_db_names() {
return array('id', 'glossary_entries', 'timemodified');
} //glossary_db_names
?>

View File

@ -7,6 +7,7 @@
// generic information; required
$doc->docid = $resource['id'];
$doc->title = strip_tags($resource['name']);
$doc->date = $resource['timemodified'];
$doc->author = '';
$doc->contents = strip_tags($resource['summary']).' '.strip_tags($resource['alltext']);

View File

@ -21,6 +21,7 @@
// generic information; required
$doc->docid = $page->id;
$doc->title = $page->pagename;
$doc->date = $page->timemodified;
//remove '(ip.ip.ip.ip)' from wiki author field
$doc->author = preg_replace('/\(.*?\)/', '', $page->author);