Search filters

There are two ways to restrict the search to a certain area of your site

  1. Control what is indexed by our crawler
  2. Index everything, but control what is returned by the search

1. Site areas – Control what is indexed

With Site area settings you can define which sections of your website are indexed. For example, if you want to leave the News section (domain.com/news/) out from the search, create a Site area setting /news/ EXCLUDE. If you want to index only News section, create two Site area rules:

/news/ 100%
/ EXCLUDE

This would leave URLs with “/news/” in the index. For the full documentation of Site area settings, see Site areas instructions. For other ways to exclude content from AddSearch, see Including and Excluding content.

2. Category filters – Control what is shown

If you want to restrict the search only on certain pages, you can do it by using category filters. The category is a property of an indexed page determined by its domain and each path segment. For example, a page with URL www.example.org/some/path would have a category property “0=www.example.org, 1=some, 2=path”. You can configure the search script to limit its results to pages that for example have a certain domain or first path segment.

Category filters

Maybe you have a forum section, and would like it to have its own search that would only return forum posts, and have those results excluded from the main site’s search. Here are some examples of how this could be accomplished:

Main site at www.example.com, forum at forum.example.com

Search script snippet on the main site:
<script src="https://addsearch.com/js/?key=####&categories=0xwww.example.com"></script>

Search script snippet on forum:
<script src="https://addsearch.com/js/?key=####&categories=0xforum.example.com"></script>

Main site at www.example.com, forums with combined search at www.example.com/forum and www.example.com/another-forum

Search script snippet on the main site, excluding forums:
<script src="https://addsearch.com/js/?key=####&categories=!1xforum,!1xanother-forum"></script>

Search script snippet on forum:
<script src="https://addsearch.com/js/?key=####&categories=1xforum,1xanother-forum"></script>

To limit search results to a subpath, use slash instead of a comma to define the nested category. For example “categories=1xpublic/2xforum” would limit the search path “/public/forum”.

Filter by file type

You can filter search to PDFs only with the category filter categories=doctype_pdf.

Dynamic category filters

If you are using our Separate results page view, you can implement dynamic category filters and let your users filter results in real-time.

Filtering against addsearch-category

If you define page’s category with the addsearch-category meta tag, you can filter search results against that tag’s value. For example, only pages with the tag:

<meta name="addsearch-category" content="products" />

could be searched with the categories parameter:

<script src="https://addsearch.com/js/?key=####&categories=products"></script>