<p>In the case of relational fields, on the title of the related Assets/Categories/Entries is searchable.</p>
<p>As stated in the documentation:</p>
<blockquote>
<p>For Matrix fields, the top-level <strong>Use this field’s values as search keywords</strong> setting determines whether any sub-fields will factor into results for the parent. For relational fields like Assets, Categories, and Entries, the setting determines whether related titles should factor into search results.</p>
</blockquote>

CC BY-SA 4.0
2021-06-21T22:52:17.970Z
Thank you Oli.  Just wondering whether the 'Use this field’s values as search keywords' setting will be taken for account for relational fields as well one of these days.  I can see this as a really powerful feature as we can't jam every single keyword into the title in most cases.
biko
CC BY-SA 4.0
2021-06-04T12:29:21.517Z
2021-06-04T12:29:21.517Z
Oli
<p>Craft CMS 3.6.11.2 / Commerce 3.2.17.4</p>
<p>We have a <code>Stores</code> structure section that contains fields (searchable) such as phone, address, etc.  These <code>Stores</code> are assigned as <code>Entries</code> (searchable, max of 1) to <code>Commerce products</code>.</p>
<p>When searching for products with a keyword that matches a <code>Store</code> phone, address, etc,  none of these products are returned.</p>
<p>The search query is basic and as follows:</p>
<pre><code>{% set search_query = '9999' %}
{% set products_query = craft.products.type('products').search(search_query) %}
</code></pre>
<p>So e.g., if <code>9999</code> is the phone number of a <code>Store</code> and we have <code>Products</code> that are assigned that <code>Store</code>, the search results return nothing.</p>
<p>Has anyone ever had this issue?  Is there a specific query that can solve this?</p>

<entries><search><relations><plugin-craftcommerce3><products>
Commerce search: return products containing keywords in related entries' fields
# Commerce search: return products containing keywords in related entries' fields

(Asked by: username_0 on 2021-06-03)

Craft CMS 3.6.11.2 / Commerce 3.2.17.4
We have a Stores structure section that contains fields (searchable) such as phone, address, etc.  These Stores are assigned as Entries (searchable, max of 1) to Commerce products.
When searching for products with a keyword that matches a Store phone, address, etc,  none of these products are returned.
The search query is basic and as follows:
{% set search_query = '9999' %}
{% set products_query = craft.products.type('products').search(search_query) %}

So e.g., if 9999 is the phone number of a Store and we have Products that are assigned that Store, the search results return nothing.
Has anyone ever had this issue?  Is there a specific query that can solve this?

**Tags:** entries, search, relations, plugin-craftcommerce3, products

---

## 1 answers

### Answer by username_1 on 2021-06-04. Score: 1 | Accepted answer

In the case of relational fields, on the title of the related Assets/Categories/Entries is searchable.

As stated in the documentation:

> For Matrix fields, the top-level **Use this field’s values as search keywords** setting determines whether any sub-fields will factor into results for the parent. For relational fields like Assets, Categories, and Entries, the setting determines whether related titles should factor into search results.

> **Comments:**
> **username_0**: Thank you Oli.  Just wondering whether the 'Use this field’s values as search keywords' setting will be taken for account for relational fields as well one of these days.  I can see this as a really powerful feature as we can't jam every single keyword into the title in most cases.  

---

