После обновления модуль поиска не дает результатов
Я обновил веб-сайт с D6 ->D7 с помощью команды Drush site-upgrade
. Используя скрипт bash, он берет drush archive-dump
сайта D6, гарантирует, что он соответствует последней версии D6, и обновляет его до Drupal 7. После обновления я применяю новую тему и конфигурацию с помощью модуля Configuration
.
После обновления, если я выполню повторный индекс поиска, я увижу следующий результат:
drush cron -v Initialized Drupal 7.33 root directory at [notice] /var/www/2014/comparative_literature/snapshot/dest_www Initialized Drupal site comparative-literature at [notice] sites/comparative-literature Indexing node 1. [ok] Indexing node 2. [ok] Indexing node 3. [ok] Indexing node 4. [ok] Indexing node 5. [ok] Indexing node 6. [ok] Indexing node 7. [ok] Indexing node 8. [ok] Indexing node 9. [ok] Undefined index: email email.module:109 [notice] Undefined index: email email.module:109 [notice] Undefined property: stdClass::$uri file.module:737 [notice] Undefined property: stdClass::$filemime file.module:775 [notice] Undefined property: stdClass::$filemime file.module:819 [notice] Undefined property: stdClass::$filemime file.module:862 [notice] Undefined property: stdClass::$filemime file.module:834 [notice] Undefined property: stdClass::$filemime file.module:834 [notice] Undefined property: stdClass::$filemime file.module:834 [notice] Undefined property: stdClass::$filemime file.module:834 [notice] Undefined property: stdClass::$filemime file.module:744 [notice] Undefined property: stdClass::$filesize file.module:744 [notice] Undefined property: stdClass::$filename file.module:750 [notice] Indexing node 15. [ok] Undefined index: email email.module:109 [notice] Undefined index: email email.module:109 [notice] Undefined property: stdClass::$uri file.module:737 [notice] Undefined property: stdClass::$filemime file.module:775 [notice] Undefined property: stdClass::$filemime file.module:819 [notice] Undefined property: stdClass::$filemime file.module:862 [notice] Undefined property: stdClass::$filemime file.module:834 [notice] Undefined property: stdClass::$filemime file.module:834 [notice] Undefined property: stdClass::$filemime file.module:834 [notice] Undefined property: stdClass::$filemime file.module:834 [notice] Undefined property: stdClass::$filemime file.module:744 [notice] Undefined property: stdClass::$filesize file.module:744 [notice] Undefined property: stdClass::$filename file.module:750 [notice] Indexing node 16. [ok] Indexing node 18. [ok] Indexing node 19. [ok] Indexing node 20. [ok] Indexing node 21. [ok] Indexing node 22. [ok] Indexing node 23. [ok] Indexing node 24. [ok] Indexing node 25. [ok] Indexing node 26. [ok] WD cron: Cron run completed. [notice] Cron run successful. [success] Command dispatch complete [notice]
Этот сайт прост, как 3 типа контента, которые являются Основными страницами, преподавателями и новостями. Страницы индексируйте нормально выше, а ошибки в новостях и преподавательском составе делают file
(выстрелы в голову людей) и проблемы с полем электронной почты, я думаю...
Но, когда я использую сайт для редактирования страницы или отправки изображения преподавателю, кажется, что он работает нормально. Индекс поиска построен, и содержимое находится в таблицах, но ничего не возвращается при поиске, скажемacademics
и его ключевое слово во встроенном индексе, найденном в базовых узлах типа контента "Страница" Drupal.
Страница поиска иногда выдает уведомления, такие как (связанные с проблемами полей файлов, проблемами полей электронной почты и т.д.):
Notice: Undefined index: email in email_field_formatter_view() (line 109 of /project/drupalwww/sites/mysite/modules/contrib/email/email.module). Notice: Undefined index: email in email_field_formatter_view() (line 109 of /project/drupalwww/sites/mysite/modules/contrib/email/email.module). Notice: Undefined property: stdClass::$uri in theme_file_link() (line 737 of /project/drupalwww/modules/file/file.module). Notice: Undefined property: stdClass::$filemime in theme_file_icon() (line 775 of /project/drupalwww/modules/file/file.module). Notice: Undefined property: stdClass::$filemime in file_icon_path() (line 819 of /project/drupalwww/modules/file/file.module). Notice: Undefined property: stdClass::$filemime in file_icon_map() (line 862 of /project/drupalwww/modules/file/file.module). Notice: Undefined property: stdClass::$filemime in file_icon_path() (line 834 of /project/drupalwww/modules/file/file.module). Notice: Undefined property: stdClass::$filemime in file_icon_path() (line 834 of /project/drupalwww/modules/file/file.module). Notice: Undefined property: stdClass::$filemime in file_icon_path() (line 834 of /project/drupalwww/modules/file/file.module). Notice: Undefined property: stdClass::$filemime in file_icon_path() (line 834 of /project/drupalwww/modules/file/file.module). Notice: Undefined property: stdClass::$filemime in theme_file_link() (line 744 of /project/drupalwww/modules/file/file.module). Notice: Undefined property: stdClass::$filesize in theme_file_link() (line 744 of /project/drupalwww/modules/file/file.module). Notice: Undefined property: stdClass::$filename in theme_file_link() (line 750 of /project/drupalwww/modules/file/file.module). Notice: Undefined index: text_processing in _text_sanitize() (line 319 of /project/drupalwww/modules/field/modules/text/text.module). Notice: Undefined index: text_processing in _text_sanitize() (line 319 of /project/drupalwww/modules/field/modules/text/text.module).
Насколько я могу судить, ошибок нет, только Notices
во время процесса обновления. Что ж, на сайте есть 1 ошибка из Последовательного поля , но на странице проекта говорится, что ее следует игнорировать. Миграция CCK показывает, что все поля перенесены, хотя, возможно, поле электронной почты и ссылки не имеет связи с их исходным типом контента?:
Я так раздражен! Я получаю много Notices
, но ничего не фатальная ошибка, и сайт доступен для редактирования как зарегистрированный пользователь, насколько я могу судить. Но я бы с удовольствием исправил поиск (и в качестве бонуса избавился от Notices
) ...
Любые указания, мысли, советы, молитвы приветствуются. :D
1 answers
Ладно, значит, я был немного глуп, а функции - отстой. Позвольте мне объяснить...
В какой-то момент в моей разработке темы D7 для обновления моего сайта я создал функцию:
function MYTHEME_preprocess_search_result(...) { ...}
К результатам поиска по теме. Это не работало правильно, поэтому я прокомментировал его тело:
function MYTHEME_preprocess_search_result($vars) {
#dpm($vars);
#dpm($vars['info']);
#unset($vars['info']);
}
Но в моей функции выше мне не хватает оператора передачи по ссылке для параметра $vars
. Правильная сигнатура функции:
function MYTHEME_preprocess_search_result(&$vars) { /* ... */ }
Просто прокомментировав тело функции, которую я оставил сама функция потребляет $vars
и никогда не возвращает никаких results
(из-за отсутствия оператора передачи по ссылке), что приводит к тому, что в каждом поиске говорится "Результаты поиска не найдены", но не вызывает никаких ошибок.
Примечание:
- Я увидел свою ошибку после того, как использовал Xdebug и некоторые целевые точки останова для отслеживания результатов в functionn
search_view
, например, из формы поиска HTTPPOST
. - Я говорю, что функции отстой, потому что если бы это был объектно-ориентированный метод, то IDE могла бы сказать подпись была ошибочной; полагаться на функции
hook
, созданные из макросов, я думаю, довольно глупо. - Возможно, были и другие способы проверить это, например, изучить предыдущую фиксацию Git, но для меня этот тип ошибки действительно очень сложно отследить.