Error when searching terms

I get this error when trying to search something, I’m not getting it all the time, but only on some items.

exception 'Omeka_View_Exception' with message 'A current item variable has not been set to this view.' in /home/cria/public_html/prod/application/views/helpers/GetCurrentRecord.php:27
Stack trace:
#0 [internal function]: Omeka_View_Helper_GetCurrentRecord->getCurrentRecord('item', true)
#1 /home/cria/public_html/prod/application/libraries/Zend/View/Abstract.php(350): call_user_func_array(Array, Array)
#2 /home/cria/public_html/prod/application/libraries/globals.php(1854): Zend_View_Abstract->__call('getCurrentRecor...', Array)
#3 /home/cria/public_html/prod/application/libraries/globals.php(1854): Omeka_View->getCurrentRecord('item', true)
#4 /home/cria/public_html/prod/application/libraries/globals.php(2140): get_current_record('item')
#5 /home/cria/public_html/prod/themes/cria/search/index.php(27): item_image('square_thumbnai...')
#6 /home/cria/public_html/prod/application/libraries/Omeka/View.php(117): include('/home/cria/publ...')
#7 /home/cria/public_html/prod/application/libraries/Zend/View/Abstract.php(888): Omeka_View->_run('/home/cria/publ...')
#8 /home/cria/public_html/prod/application/libraries/Zend/Controller/Action/Helper/ViewRenderer.php(912): Zend_View_Abstract->render('search/index.ph...')
#9 /home/cria/public_html/prod/application/libraries/Zend/Controller/Action/Helper/ViewRenderer.php(933): Zend_Controller_Action_Helper_ViewRenderer->renderScript('search/index.ph...', NULL)
#10 /home/cria/public_html/prod/application/libraries/Zend/Controller/Action/Helper/ViewRenderer.php(972): Zend_Controller_Action_Helper_ViewRenderer->render()
#11 /home/cria/public_html/prod/application/libraries/Zend/Controller/Action/HelperBroker.php(277): Zend_Controller_Action_Helper_ViewRenderer->postDispatch()
#12 /home/cria/public_html/prod/application/libraries/Zend/Controller/Action.php(527): Zend_Controller_Action_HelperBroker->notifyPostDispatch()
#13 /home/cria/public_html/prod/application/libraries/Zend/Controller/Dispatcher/Standard.php(308): Zend_Controller_Action->dispatch('indexAction')
#14 /home/cria/public_html/prod/application/libraries/Zend/Controller/Front.php(954): Zend_Controller_Dispatcher_Standard->dispatch(Object(Zend_Controller_Request_Http), Object(Zend_Controller_Response_Http))
#15 /home/cria/public_html/prod/application/libraries/Zend/Application/Bootstrap/Bootstrap.php(105): Zend_Controller_Front->dispatch()
#16 /home/cria/public_html/prod/application/libraries/Zend/Application.php(384): Zend_Application_Bootstrap_Bootstrap->run()
#17 /home/cria/public_html/prod/application/libraries/Omeka/Application.php(79): Zend_Application->run()
#18 /home/cria/public_html/prod/index.php(23): Omeka_Application->run()
#19 {main}

If you can find a distinction between items that give this error and items that don’t, that will help a lot in tracking down the problem.

It could be something as simple as an undefined variable in your cria theme. If that code is available someplace, that will also help us find the problem.

Thanks for the reply!

The code is available here https://github.com/villaitatti/cria

I was looking for a video so I typed “Taylor”, I also noticed that if I type any surname of the people in the colophon, I get the same error.
Word that don’t give an error are all the words that are contained in an item.

I commented out line 27 of index.php (I’ll deal with it later) and now I get another error (it’s the same one but different line)

#8 /home/cria/public_html/prod/themes/cria/search/index.php(41): metadata('item', Array)

And the code is like this:

<?php echo metadata('item', array('Dublin Core','Identifier')); ?>