[OJS 3.2.0.2] search problem

Hello there,

I’ve just installed the OJS 3.2.0.2 via Softaculous Apps Installer. When I try to search text in the front search box, it showed empty results.

In the error log I have this:
PHP Fatal error: Uncaught Error: Call to a member function getBestArticleId() on null in …/cache/t_compile/950a87c15207be7a61c6679a89161161bf977013^7cf1cd52b8ba8108de77f197078de34b733dd394_0.app.frontendobjectsarticlesum.php:26
Stack trace:
#0 …/lib/pkp/lib/vendor/smarty/smarty/libs/sysplugins/smarty_template_resource_base.php(123): content_5edcf18d3b5250_24662694(Object(Smarty_Internal_Template))
#1 …/lib/pkp/lib/vendor/smarty/smarty/libs/sysplugins/smarty_template_compiled.php(114): Smarty_Template_Resource_Base->getRenderedTemplateCode(Object(Smarty_Internal_Template))
#2 …/lib/pkp/lib/vendor/smarty/smarty/libs/sysplugins/smarty_internal_template.php(216): Smarty_Template_Compiled->render(Object(Smarty_Internal_Template))
#3 …/lib/pkp/lib/vendor/smarty/smarty/libs/sysplugins/smarty_internal_template.php(385): Smarty_Internal_Template->render()
#4 …/cac in …/cache/t_compile/950a87c15207be7a61c6679a89161161bf977013^7cf1cd52b8ba8108de77f197078de34b733dd394_0.app.frontendobjectsarticlesum.php on line 26

I have done the following steps:

run rebuildSearchIndex.php
and here is the result
Clearing index … done
Indexing “my journal” … 12 articles indexed
I have cleaned data cache and template cache from Administrator page
clean manually …/cache/.php and …/cache/t_compile/.php
but the problem still remains.

Any helps to fix this?

Thanks.
All the best.

any help on this issue ?

Hi @bgb,

Is this a new installation? If so, how did you add your content – through the normal workflow, or using QuickSubmit, or using another import/export process?

Regards,
Alec Smecher
Public Knowledge Project Team

hi @asmecher,
Yes, it is a new installation. we are now on the process of second issue with normal workflow. But, the first issue was uploaded using QuickSubmit

Hi @bgb,

I suspect this was already solved in a subsequent release – there have been several since OJS 3.2.0-2. I’d recommend upgrading.

Regards,
Alec Smecher
Public Knowledge Project Team

Hello @asmecher, how are you?

I am having the same problem and I want to know if this has been resolved. I’m using OJS 3.2.0.3

Thank you.

Hi @matheusotoni,

I’d still consider OJS 3.2.0-3 to be an out-of-date release – the latest 3.2.1-x release does have some improvements that might resolve this issue.

Regards,
Alec Smecher
Public Knowledge Project Team

Hi @asmecher,
I have the same error but with OJS 3.2.1.1:

[15-Sep-2020 14:21:51 Europe/Berlin] PHP Fatal error:  Uncaught Error: Call to a member function getBestArticleId() on null in /.../sys/cache/t_compile/b8aeb4f45ef66151757782d3bd98ab8c4b894bfd^504348cc7222e1110a6019067f9a002726c02324_0.plugins-plugins-generic-pdfJsViewer-generic-pdfJsViewer.display.tpl.php:63
Stack trace:
#0 /.../sys/lib/pkp/lib/vendor/smarty/smarty/libs/sysplugins/smarty_template_resource_base.php(123): content_5f5a330967cd94_80567227(Object(Smarty_Internal_Template))
#1 /.../sys/lib/pkp/lib/vendor/smarty/smarty/libs/sysplugins/smarty_template_compiled.php(114): Smarty_Template_Resource_Base->getRenderedTemplateCode(Object(Smarty_Internal_Template))
#2 /.../sys/lib/pkp/lib/vendor/smarty/smarty/libs/sysplugins/smarty_internal_template.php(216): Smarty_Template_Compiled->render(Object(Smarty_Internal_Template))
#3 /.../sys/lib/pkp/lib/vendor/smarty/smarty/libs/sysplugins/smarty_internal_template.php(385): Smarty_Internal_Template->render() in /.../sys/cache/t_compile/b8aeb4f45ef66151757782d3bd98ab8c4b894bfd^504348cc7222e1110a6019067f9a002726c02324_0.plugins-plugins-generic-pdfJsViewer-generic-pdfJsViewer.display.tpl.php on line 63

This is our last remaining PHP Fatal error, after being able to fix some in the last days. It occurs about every 5 to 15 minutes.
What could be the solution to this?

Thank you and kind regards

Hi @adm_sub,

This suggests that there’s a call to getBestArticleId in cache/t_compile/b8aeb4f45ef66151757782d3bd98ab8c4b894bfd^504348cc7222e1110a6019067f9a002726c02324_0.plugins-plugins-generic-pdfJsViewer-generic-pdfJsViewer.display.tpl.php, which is compiled from plugins/generic/pdfJsViewer/templates/display.tpl. However, in OJS 3.2.1-1, there shouldn’t be any reference to getBestArticleId in plugins/generic/pdfJsViewer/templates/display.tpl. Do you see one there?

Regards,
Alec Smecher
Public Knowledge Project Team

Hi @asmecher,

ah, now I see! Yes, our display.tpl contains a reference to getBestArticleId. Since we want to display the complete article information (author name, title, journal name, volume and issue numbers, etc.) in the header of the PDF viewer we have modified the code.
This is the content of our display.tpl that generated the error:

<a href="{url page="article" op="view" path=$article->getBestArticleId()}" class="title">
  {$article->getAuthorString()|escape} ({$issue->getYear()}):
  {$article->getLocalizedTitle()|escape}. In: sub\urban. zeitschrift für kritische stadtforschung
  {$issue->getVolume()}
  ({$issue->getNumber()})
</a>

Now, I have replaced the first line with the unmodified OJS 3.2.1.1 code and deleted the reference to getBestArticleId:

<a href="{$parentUrl}" class="title">
  {$article->getAuthorString()|escape} ({$issue->getYear()}):
  {$article->getLocalizedTitle()|escape}. In: sub\urban. zeitschrift für kritische stadtforschung
  {$issue->getVolume()}
  ({$issue->getNumber()})
</a>

Is the code correct now? Or do I need to further modify the code if the header should show the additional article information?

Hi @adm_sub,

I suspect what happened is that the modified code was working in OJS 3.1.x, but when you upgraded to 3.2.x, the error started occurring. With the introduction of versioning in OJS 3.2.x, many references to $article need to be changed to $publication, since most of the submission’s metadata is now versioned in the $publication object (which represents the current version of the article you’re looking at). Check out the Release Notebook for OJS 3.2.

Note that the display.tpl template you’re modifying is intended to display not only articles (where the $article and $publication objects will be present) but also issue galleys (where they will not). If you’re using issue galleys, you’ll need to make sure your modifications are also compatible with those.

Regards,
Alec Smecher
Public Knowledge Project Team

Hi @asmecher I am experimenting the same issue as @bgb. I have installed OJS 3.2.1.2. Should I upgrade my OJS version or is there any other solution? Thanks

This topic was automatically closed after 10 days. New replies are no longer allowed.