Avoiding warning messages

skala
Julio Montoya 15 years ago
parent 58993a9c9f
commit c22aaf5af2
  1. 9
      main/inc/lib/search/xapian/XapianIndexer.class.php

@ -101,22 +101,24 @@ abstract class XapianIndexer {
*/ */
function index() { function index() {
try { try {
if (!empty($this->chunks)) {
foreach ($this->chunks as $chunk) { foreach ($this->chunks as $chunk) {
$doc = new XapianDocument(); $doc = new XapianDocument();
$this->indexer->set_document($doc); $this->indexer->set_document($doc);
if (!empty($chunk->terms)) {
foreach ($chunk->terms as $term) { foreach ($chunk->terms as $term) {
/* FIXME: think of getting weight */ /* FIXME: think of getting weight */
$doc->add_term($term['flag'] . $term['name'], 1); $doc->add_term($term['flag'] . $term['name'], 1);
} }
}
// free-form index all data array (title, content, etc) // free-form index all data array (title, content, etc)
if (!empty($chunk->data)) {
foreach ($chunk->data as $key => $value) { foreach ($chunk->data as $key => $value) {
$this->indexer->index_text($value, 1); $this->indexer->index_text($value, 1);
} }
}
$doc->set_data($chunk->xapian_data, 1); $doc->set_data($chunk->xapian_data, 1);
$did = $this->db->add_document($doc); $did = $this->db->add_document($doc);
//write to disk //write to disk
@ -125,6 +127,7 @@ abstract class XapianIndexer {
return $did; return $did;
} }
} }
}
catch (Exception $e) { catch (Exception $e) {
Display::display_error_message($e->getMessage()); Display::display_error_message($e->getMessage());
exit(1); exit(1);

Loading…
Cancel
Save