# Simple Domain Filter using Javascript V2

**URL:** <https://community.swiftype.com/t/simple-domain-filter-using-javascript-v2/880>\
**Category:** Helpline\
**Created:** [September 29, 2018, 5:42am UTC](https://community.swiftype.com/t/simple-domain-filter-using-javascript-v2/880 "2018-09-29T05:42:19Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![maurice](https://sea1.discourse-cdn.com/flex019/user_avatar/community.swiftype.com/maurice/32/85_2.png) [@maurice](https://community.swiftype.com/u/maurice)\
**Post date:** [September 29, 2018, 5:42am UTC](https://community.swiftype.com/t/simple-domain-filter-using-javascript-v2/880/1 "2018-09-29T05:42:19Z")

</div>

I’m trying to create a simple search filter. We have a search box that crawls the entire site, I’d like a way to filter just the URLs /comments/[comment\_id]/, which are our Forum threads.

I was told this can only be done using Faceted search, which is kind of like building a house when all I need is an umbrella.

I found this bit of documentation which looked promising, section titled “Code Snippets:” then “HTML”

> **[Tags | Swiftype Documentation](https://swiftype.com/documentation/site-search/styleguide/tags)**
>
> Learn how to get the most out of Swiftype

return {‘page’: {‘filters’: {‘type’: selectedType}}};  
searchFilterFields

I can’t find much related to “page” or “filters \> type” in the documentation. This is as close as I can get:

> [@Public API Request to see result from specify domain-filter](https://community.swiftype.com/t/public-api-request-to-see-result-from-specify-domain-filter/449):
>
> We have added domain-filter in our webpage. \<meta class="swiftype" name="domain-filter" data-type="string" content="Doc1" /\> \<meta class="swiftype" name="domain-filter" data-type="string" content="Doc2" /\> How can I use Public API request to get results from just Doc1? Can someone give a sample? Thanks, Gaurav Soni

What is a domain filter? How can I set one up and use it like that simple example above? It looks exactly like what I’m after, a radio box to filter the existing crawled content.

Any help is much appreciated.

---

<div class="post-metadata">

**Author:** ![smiller](https://avatars.discourse-cdn.com/v4/letter/s/8c91f0/32.png) [@smiller](https://community.swiftype.com/u/smiller)\
**Post date:** [October 1, 2018, 1:15pm UTC](https://community.swiftype.com/t/simple-domain-filter-using-javascript-v2/880/2 "2018-10-01T13:15:29Z")

</div>

The question you linked is not filtering directly on the URL. They are setting up a custom field with meta tags ([documentation](https://swiftype.com/documentation/site-search/crawler-features#meta)) called “Domain-Filter”, setting the value to whatever, and then filtering on that field value. So you would have to add a custom tag to each of your Forum pages if you wanted to copy this method.

---

<div class="post-metadata">

**Author:** ![maurice](https://sea1.discourse-cdn.com/flex019/user_avatar/community.swiftype.com/maurice/32/85_2.png) [@maurice](https://community.swiftype.com/u/maurice)\
**Post date:** [October 6, 2018, 7:38am UTC](https://community.swiftype.com/t/simple-domain-filter-using-javascript-v2/880/3 "2018-10-06T07:38:12Z")

</div>

Hey Smiller!

So I actually tagged all the page/sections I wanted to filter last week. I still can’t figure out how to actually filter the results with V2 embedded javascript.

I want to do something like this:

```
_st('install','SWIFTYPE-ENGINE-CODE','2.0.0', {
    filters: {'page': {'tags': 'Forum'}}
});

```

There are a few [code samples here](https://swiftype.com/documentation/site-search/tutorials/jquery), but they’re only relevant to a custom jquery installation, which I want to avoid as I’m not doing anything fancy.

Any help is much appreciated 🙏
