Forum

Thread tagged as: Question, Problem

Perch Search App - Excluding/Including apps

Hi guys,

I'm trying to use perch_content_search( ) to return two separate result sets:

  1. Results from the Blog App.
  2. Results excluding the Blog App.

In the docs, it says that I can use the apps parameter to restrict my search to certain apps (such as PerchBlog).

This doesn't seem to work. Please see below for my code:

perch_content_search($q,[
    'apps'=>'perch_blog',
    'template'=>'htb_article-returned.html'
]);

I've tried it with PerchBlog, blog, perchblog, Perch_Blog and perch_blog, but still they return content from pages on the site and doesn't appear to be restricted to the Blog App.

Also - is it possible to exclude apps from the search, rather than include them? I'd need to be able to exclude the Blog App from the second result set, and I was wondering if Perch is able to do that.

Thanks, Harry

Harry Ray

Harry Ray 0 points

  • 3 years ago
Hussein Al Hammad

Hussein Al Hammad 105 points
Registered Developer

Hello Harry,

I think you need to pass an array:

perch_content_search($q, [
'apps' => ['PerchBlog'],
'template' => 'htb_article-returned.html'
]);

Hi Hussein,

Thanks for the help! That's sorted now, thanks!