Simple Domain Filter using Javascript V2

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”

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:

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.

The question you linked is not filtering directly on the URL. They are setting up a custom field with meta tags (documentation) 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.

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, 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 :pray: