* [misc] fix bug when building index.

This commit is contained in:
liumengyi
2025-01-06 15:56:22 +08:00
committed by 田淑杰
parent 7f0756cd53
commit 12e93c5faf
2 changed files with 3 additions and 3 deletions
+2 -2
View File
@@ -665,8 +665,8 @@ class searchModel extends model
$index->objectType = $objectType;
$index->objectID = $object->{$fields->id};
$index->title = $object->{$fields->title};
$index->addedDate = !empty($object->{$fields->addedDate}) ? $object->{$fields->addedDate} : NULL;
$index->editedDate = !empty($object->{$fields->editedDate}) ? $object->{$fields->editedDate} : NULL;
$index->addedDate = !empty($object->{$fields->addedDate}) ? (!helper::isZeroDate($object->{$fields->addedDate}) ? $object->{$fields->addedDate} : NULL) : NULL;
$index->editedDate = !empty($object->{$fields->editedDate}) ? (!helper::isZeroDate($object->{$fields->editedDate}) ? $object->{$fields->editedDate} : NULL) : NULL;
$index->vision = isset($object->vision) ? $object->vision : 'rnd';
$index->content = '';
+1 -1
View File
@@ -1216,7 +1216,7 @@ class searchTao extends searchModel
if($convertedFile) $object->comment .= substr(file_get_contents($convertedFile), 0, $this->config->search->maxFileSize);
}
if($file->extension == 'txt') $object->comment .= substr(file_get_contents($file->realPath), 0, $this->config->search->maxFileSize);
if($file->extension == 'txt' && file_exists($file->realPath)) $object->comment .= substr(file_get_contents($file->realPath), 0, $this->config->search->maxFileSize);
}
$object->comment = htmlspecialchars($object->comment);