<p>For filtering entries based on relationships (categories/assets/users/tags/other entries), you need to use the <code>relatedTo</code> parameter, not the <code>search</code> parameter.</p>

<p>Here's an example: <a href="https://craftcms.stackexchange.com/questions/10321/filter-based-search-form">Filter based Search Form</a></p>

CC BY-SA 4.0
2020-05-19T11:54:05.000Z
Thank you. Let me check
Rakhi Vijayan
CC BY-SA 4.0
2020-05-19T12:00:51.533Z
can you please advice, what is this `.group('knowledge')` in query?
Rakhi Vijayan
CC BY-SA 4.0
2020-05-19T13:02:18.497Z
That's simply outputting categories from a category group called 'knowledge'. It's not relevant to your question - you just need to use the `relatedTo` parameter instead of the `search` parameter as detailed in that question.
James Smith
CC BY-SA 4.0
2020-05-20T11:37:48.427Z
Thank you. `{% paginate craft.entries.section('blog').relatedTo('category:ui-ux OR category:healthcare').orderBy('postDate desc').limit(10) as pageInfo, entryTemplates %}`  . This not works for me, getting empty results.
Rakhi Vijayan
CC BY-SA 4.0
2020-05-20T15:04:56.613Z
To use the `relatedTo` parameter you need to pass it either the category element(s), or the id(s) of the category/categories. See the docs: https://docs.craftcms.com/v3/relations.html#the-relatedto-parameter
James Smith
CC BY-SA 4.0
2020-05-19T11:17:26.523Z
2020-05-19T11:17:26.523Z
James Smith
<p>I have a blog section with multi select categories. I want to filter all the blogs based on that multi select categories in the website. When I tried</p>

<pre><code> .search('category:ui-ux OR category:web-designs')
</code></pre>

<p>the result blogs are not accurate. </p>

<p>Category is a multi select field. So multiple category may assigned to one blog. I will list all these categories in my front end and need to filter blogs based on that.</p>

<p>How I will do this search?</p>

CC BY-SA 4.0
2020-05-19T07:30:17.847Z
Is the field handle you are trying to search `category`?
Oli
CC BY-SA 4.0
2020-05-19T09:54:40.003Z
yes , the field handle of the multi select field that I added from admin is 'category'.
Rakhi Vijayan
<craft3><search><field><filter><category>
How to search based on a Multi select category field in Craft 3?
# How to search based on a Multi select category field in Craft 3?

(Asked by: username_0 on 2020-05-19)

I have a blog section with multi select categories. I want to filter all the blogs based on that multi select categories in the website. When I tried
 .search('category:ui-ux OR category:web-designs')

the result blogs are not accurate. 
Category is a multi select field. So multiple category may assigned to one blog. I will list all these categories in my front end and need to filter blogs based on that.
How I will do this search?

**Tags:** craft3, search, field, filter, category

> **Comments:**
> **username_1**: Is the field handle you are trying to search `category`?  
> **username_0**: yes , the field handle of the multi select field that I added from admin is 'category'.  

---

## 1 answers

### Answer by username_2 on 2020-05-19. Score: 1

For filtering entries based on relationships (categories/assets/users/tags/other entries), you need to use the `relatedTo` parameter, not the `search` parameter.

Here's an example: [Filter based Search Form](https://craftcms.stackexchange.com/questions/10321/filter-based-search-form)

> **Comments:**
> **username_0**: Thank you. Let me check  
> **username_0**: can you please advice, what is this `.group('knowledge')` in query?  
> **username_2**: That's simply outputting categories from a category group called 'knowledge'. It's not relevant to your question - you just need to use the `relatedTo` parameter instead of the `search` parameter as detailed in that question.  
> **username_0**: Thank you. `{% paginate craft.entries.section('blog').relatedTo('category:ui-ux OR category:healthcare').orderBy('postDate desc').limit(10) as pageInfo, entryTemplates %}`  . This not works for me, getting empty results.  
> **username_2**: To use the `relatedTo` parameter you need to pass it either the category element(s), or the id(s) of the category/categories. See the docs: https://docs.craftcms.com/v3/relations.html#the-relatedto-parameter  

---

