SimpleSearch Self-Controlled Page Configuration

After doing some code examination and few unsuccessful attempts to solve the issue I have found what I was missing and the answer is the following.

If you want to have few pages and search their content (independently or not), you need search results page where you can display search results. To be more specific let’s say that I have /user/pages/01.blog1 and /user/pages/02.blog2 pages. Both of them have their blog.md configuration file and frontmatter given bellow:

title: Blog {1|2}
routes:
    default: '/blog{1|2}'
content:
    items:
        - '@self.children'
    order:
        by: date
        dir: desc
    limit: 10
    pagination: true
simplesearch:
    route: /blog{1|2}/search
    filters: 
        - @self
    filter_combinator: and

You will notice that atribute route in simplesearch is not pointing to the blog page. The presented route is logical location of search results pages for blog1 and blog2. Search result pages could be physical located in /user/pages/search_blog1 and /user/pages/search_blog2 and they will have simplesearch_results.md configuration file with following frontmatter:

title: Blog{1|2} search results
routes:
    default: '/blog{1|2}/search'
content:
    items:
        - '@page.children': '/blog{1|2}'
    order:
        by: title
        dir: desc
 simplesearch:
     route: @self
     filters:
         - @self
     filter_combinator: and

To be fair, with this method you just redirect search query from blog page to the hidden search page. In items you can put just - @page.children: '/blog1' and SimpleSearch will search only children pages of blog and but you can add as much sources initems` as you like and they will be included in search. For example if you want to search posts from both blog pages:

items:
    - '@page.children': '/blog1'
    - '@page.children': '/blog2'

Also you can apply desired filters under atribute filters in simplesearch.

This opens another problem which is pagination of search results :slight_smile: