Answers.Body: <p>Have you checked that the custom fields are searchable by having the &quot;Use this field’s values as search keywords&quot; option checked? The value will be added to the index only after this is checked and the entry is saved. You can also <a href="https://craftcms.com/docs/3.x/searching.html#rebuilding-your-search-indexes" rel="nofollow noreferrer">rebuild the search index</a> with a console command.</p>
  <pre class="lang-sh prettyprint-override"><code>php craft resave/entries --update-search-index
  </code></pre>
  <p>I'd also recommend sticking to one syntax for the query, rather than mixing them, for ease of use.</p>
  <pre><code>{% set entryQuery = craft.entries().section('appeals') %}
  
  {% set searchQuery = craft.app.request.getParam('q') %}
  {% if searchQuery %}
      {% do entryQuery.search('appealer:' ~ searchQuery ~ ' OR  assigner:' ~ searchQuery ~ ' OR  title:' ~ searchQuery) %}
  {% endif %}
  
  {% set entries = entryQuery.all() %}
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-07-06T07:54:38.707Z
Answers.LastActivityDate: 2021-07-06T07:54:38.707Z
Answers.UserDisplayName: Ben Croker
Body: <p>I would like to use a query term for multiple fields according to their fields' handle in Craft cms 3.5.x, but unfortunately only for field title that works correctly, while for the other fields i get no results at all. Additionally i have also tried another <a href="https://stackoverflow.com/questions/68243792/craft-cms-search-multiple-fields-with-query-parameter">method here</a> without success.</p>
  <pre><code>            &lt;h1&gt;Search Results&lt;/h1&gt;
             
              {% set queryParams = {} %}
  
              {% if craft.app.request.getParam('q') %}
                  {% set searchQuery = craft.app.request.getParam('q') %}
                  {% set queryParams = queryParams|merge({
                      search:{
                            query: 'appealer:' ~ searchQuery ~ ' OR  assigner:' ~ searchQuery ~ ' OR  title:' ~ searchQuery,
                          }
                         }) %}
                  {% set queryEntries = craft.entries(queryParams).section('appeals') %}      
  
              {% endif %}
  
                  {% if queryEntries|length %}
                    &lt;p&gt;{{ queryEntries|length }} results:&lt;/p&gt;
  
                    &lt;ol&gt;
                      {% for entry in queryEntries %}
                        &lt;li&gt;&lt;a href=&quot;{{ entry.url }}&quot;&gt;{{ entry.title }}&lt;/a&gt;&lt;/li&gt;
                      {% endfor %}
                    &lt;/ol&gt;
                  {% else %}
                    &lt;p&gt;Your search for “{{ searchQuery }}” didn’t return any results.&lt;/p&gt;
                  {% endif %}
  </code></pre>
  <p>Any idea that could help me?</p>
  <p>Regards</p>
  
Tags: <search><filter>
Title: Search on multiple custom fields with a query parameter
ThreadText: # Search on multiple custom fields with a query parameter
  
  (Asked by: username_0 on 2021-07-04)
  
  I would like to use a query term for multiple fields according to their fields' handle in Craft cms 3.5.x, but unfortunately only for field title that works correctly, while for the other fields i get no results at all. Additionally i have also tried another [method here](https://stackoverflow.com/questions/68243792/craft-cms-search-multiple-fields-with-query-parameter) without success.
  
  ```
              <h1>Search Results</h1>
             
              {% set queryParams = {} %}
  
              {% if craft.app.request.getParam('q') %}
                  {% set searchQuery = craft.app.request.getParam('q') %}
                  {% set queryParams = queryParams|merge({
                      search:{
                            query: 'appealer:' ~ searchQuery ~ ' OR  assigner:' ~ searchQuery ~ ' OR  title:' ~ searchQuery,
                          }
                         }) %}
                  {% set queryEntries = craft.entries(queryParams).section('appeals') %}      
  
              {% endif %}
  
                  {% if queryEntries|length %}
                    <p>{{ queryEntries|length }} results:</p>
  
                    <ol>
                      {% for entry in queryEntries %}
                        <li><a href="{{ entry.url }}">{{ entry.title }}</a></li>
                      {% endfor %}
                    </ol>
                  {% else %}
                    <p>Your search for “{{ searchQuery }}” didn’t return any results.</p>
                  {% endif %}
  
  ```
  
  Any idea that could help me?
  
  Regards
  
  **Tags:** search, filter
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2021-07-06. Score: 2
  
  Have you checked that the custom fields are searchable by having the "Use this field’s values as search keywords" option checked? The value will be added to the index only after this is checked and the entry is saved. You can also [rebuild the search index](https://craftcms.com/docs/3.x/searching.html#rebuilding-your-search-indexes) with a console command.
  
  ```sh
  php craft resave/entries --update-search-index
  
  ```
  
  I'd also recommend sticking to one syntax for the query, rather than mixing them, for ease of use.
  
  ```
  {% set entryQuery = craft.entries().section('appeals') %}
  
  {% set searchQuery = craft.app.request.getParam('q') %}
  {% if searchQuery %}
      {% do entryQuery.search('appealer:' ~ searchQuery ~ ' OR  assigner:' ~ searchQuery ~ ' OR  title:' ~ searchQuery) %}
  {% endif %}
  
  {% set entries = entryQuery.all() %}
  
  ```
  
  
  ---
  
  