0

I have a site with around 300 entries and at least 50 custom fields. But I'm only getting results if the keyword(s) are part of the title field, I have the "Use this field's value as keywords" option checked on all my fields. Also, I tried the update search index command but it didn't work. I hope someone has a solution to this. below is my search query code.

Thank you.

{% set searchQuery = craft.app.request.getParam('q') %}
{% set entries = craft.entries()
   .search(searchQuery)
   .section('and, not referrals, not newsletterSubscribe')
   .orderBy('score').limit(15) %}
{% if entries | length %}
    <h3>Found {{ entries | length }} search results for 
    <span>{{searchQuery}}</span></h3>
    <div class="search-result__list ">
{% for entry in entries %}
    <div class="search-result__item">
    <h4><a href="{{ entry.url }}">{{ entry.title }}</a></h4>
    </div>
{% endfor %}
{% else %}
    <p>Your search for “{{ searchQuery }}” didn’t return any results.</p>
{% endif %}

1 Answer 1

1

Do you have a queue runner that executes queue jobs? The search index command only creates queue jobs to perform the indexing, they still need to be executed. Check Utilities -> Queue Manager to see if the queue jobs are actually being executed. If not, use php craft queue/run to execute all pending jobs or php craft queue/listen to create a queue runner that executes new jobs as they come in.

See the article Robust queue job handling for details.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.