
Announcements
Hi all,
We have a anonymous search page that is getting intermittent liquid errors:
- Liquid error: Exception has been thrown by the target of an invocation.
The search page does a search on knowledge articles based on the query string parameter "q" that is passed in.
We have found that:
- Sometimes the error appears for some users and not others.
- Restarting the website resolves this error - so we are resorting to restarting the website everyday. Also clearing the portal cache sometimes works.
The web template liquid code looks something like below (I have added the full code in the attachments).
{% assign query = request.params['q'] %}
{% assign validQuery = true %}
{% if query and query != "" %}
{% if query startswith '*' or query startswith '?' %}
{% assign validQuery = false %}
{% else %}
{% searchindex query: query, page: 1, page_size: 500, logical_names: 'knowledgearticle', filter:'+myorg_knowledgearticlesubtype:Article && -isinternal:Yes' %}
{% assign searchResults = searchindex %}
{% endsearchindex %}
{% endif %}
{% endif %}
<script>
var searchResults = new Array;
var filteredResults = new Array;
var displayResults = new Array;
var relatedAwards = new Array;
var activePage = 1;
var lastPage = 1;
{% if searchResults.results.size > 0 %}
{% for result in searchResults.results %}
searchResults.push(
{
title: `{{ result.title | escape }}`,
krn: `{{ result.entity.myorg_krnnumber }}`,
guid: `{{ result.entity.knowledgearticleid }}`,
subject: `{{ result.entity.myorg_subjecttextonlyforsearch }}`,
industry: '{{ result.entity.myorg_industrytextonlyforsearch }}',
award: []
}
);
{% endfor %}
{% endif %}
...
...
...
</script>
I find strange that this could be intermittent.. is there any chance it happens always when you querying using a specific filter criteria?
I would try to replicate here, to see if there is one specific scenario where it always happens.. then I would start reducing/commenting out the liquid code to see which one is causing the issue