]> git.mjollnir.org Git - moodle.git/commitdiff
Date field added to documents.
authormchampan <mchampan>
Wed, 16 Aug 2006 13:31:55 +0000 (13:31 +0000)
committermchampan <mchampan>
Wed, 16 Aug 2006 13:31:55 +0000 (13:31 +0000)
search/db/mysql.sql
search/db/postgres7.sql
search/documents/document.php
search/documents/forum_document.php
search/documents/glossary_document.php
search/documents/resource_document.php
search/documents/wiki_document.php

index 2507a495bb453bb999ceef7bd7aa0493553ec468..a8e78e750687a980d209f538ef92d827d3c0e7c9 100644 (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;
\ No newline at end of file
+) ENGINE=MyISAM AUTO_INCREMENT=1;
index 3903a65c32f03779901047c3c0a9a4f6d6f81322..7a2d7a56434d85fd0aa8f872dd322507128f19d9 100644 (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
-);
\ No newline at end of file
+);
index c5fbe3028e0b83ee785a110ac75553e8b9fd1232..fdb741afa13efecee01acf1f96b8f608753487b3 100644 (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)));
       
index c3e0da140c6f80fa240041439e77d29a1c2ea8d2..92786f4b49890f79726776a8d63edf3059483078 100644 (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']);      
       
index 7d9db6b5998d235a8f5c6cd504f05e28ddcaafa7..6ce87eb11af75af23b4ce35776d1764ad8a91f02 100644 (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());  
     
     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    
   
 ?>
\ No newline at end of file
index ee5b6f21c59e5fcff472de624b23b9775cc1ea16..204efc8e728789eddc306e79da8cc1fb496a8220 100644 (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']);
index 408c38f69e032e60a28d8e4efdce92fad762e1f6..6bdf0ad4707c7d421c4a4010c3f46aa54963d289 100644 (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);