Simplesearch and taxonomy

I have following page structure:
user/pages/

  • 02.products
    . taxonomy:category: product
    . taxonomy:tag: [p1, p2, p3]
  • 03.blog
    . taxonomy:category: blog
    . taxonomy:tag: [b1, b2, b3]
  • 04.internal
    . taxonomy:category: internal
    . taxonomy:tag: [i1, i2, i3]
  1. I have a site wide search based on simplesearch that is launched the URL /search?query=. How can I configure the simplesearch plugin to search among both 02.product and 03.blog categories. Currently I only succeed searching 1 category not multiple. I don’t find an example how to configure.

  2. I like the taxonomy to list the tags p1, p2, p3, b1, b2, b3 (this is currently working). But when clicking on p1, p2, p3 it fails to show that page. It only works for b1, b2, b3. How I have to configure so I can jump to

  3. I want to avoid taxonomy showing i1, i2, i3 tags when I’m inside 02.products and 03.blog but want all tags when I’m inside 04.internal How can I accomplish this? I guess this is not forseen in the implementation yet …

Thanks

1 - simple search can be configured to search multiple taxonomies:

filters:
    category: blog
filter_combinator: and 

So in your user/plugins/simplesearch.yaml put:

filters:
    category: [product, blog, internal]
filter_combinator: or  

This will find anything in any of those 3 taxonomies.

2 - depends on how you are displaying all those, and what the URLs are for each. WIll need to see your site probably, or even better a .zip file of your site so I can set it up and test it locally.

3 - Yah that’s very specific. Your going to have to do that logic in the twig that renders that tags. You can probably pull out or just skip tags when not in internal. Twig has some very good array functions. I suggest you look at the Twig docs: http://twig.sensiolabs.org/doc/api.html

Your 1) solution worked perfect; just what I was looking for. For 2) I’ve made an archive available here: http://aptly.eu/grav_taxonomy_ex-20150629065240.zip
The blog page shows tags. Clicking tags B works, P fail to open their corresponding page.
Maybe for 3) I’d better wait for the admin plug-in (somebody authenticated will be able to access the page, other’s don’t). Modifying twigs seems a bridge too far for me.

Regarding point 2)
I think the limitation is a combination of the plugin’s implementation and its twig.

The blog.html.twig uses sidebar.html.twig which uses taxonomylist.html.twig. That last twig inserts all the tags that the plugin has found on the website as follows:

        <a href="{{ base_url }}/tag{{ config.system.param_sep }},{{ tax|e('url') }}">{{ tax }}</a>

In this case tags come from markdown in different folders (/products and /blog).
The links associated with each tag is always /blog/tag:.
While /blog/tag:b1 is found in a blog, /blog/tag:p1 is not in the blog.
It should be /products/tag:p1 instead.

Any suggestions how to fix this …