Forum
Collection filtering
I'm trying to filter a collection by one group of 'match'=>'or'
filters, as well as another filter:
perch_collection('Blog Posts',array(
'template' => 'blog/posts/post_in_list.html',
'count'=>6,
'sort'=>'postDateTime',
'sort-order'=>'DESC',
'filter'=>array(
array(
'filter'=>array(
array(
'filter'=>'postTitle',
'match'=>'contains',
'value'=>perch_get('q')
),
array(
'filter'=>'excerpt',
'match'=>'contains',
'value'=>perch_get('q')
),
array(
'filter'=>'postDescHTML',
'match'=>'contains',
'value'=>perch_get('q')
),
),
'match'=>'or',
),
array(
'filter'=>'postDateTime',
'match'=>'lte',
'value'=>date('Y-m-d H:i:s')
),
),
));
Which is giving me the following error:
Notice: Undefined index: value in /var/www/public/ifstudies.dev/ifs-admin/core/runway/apps/content/PerchContent_Runway.class.php on line 203
Am I doing something wrong? Is this even possible? Thanks for the help.
Edit: Forgot diagnostics:
HEALTH CHECK
Perch Runway is up to date
PHP 5.6.14-1+deb.sury.org~trusty+1 is up to date
MySQL 5.5.46-0ubuntu0.14.04.2 is up to date
Image processing available
SUMMARY INFORMATION
Perch Runway: 2.8.32, PHP: 5.6.14-1+deb.sury.org~trusty+1, MySQL: mysqlnd 5.0.11-dev - 20120503 - $Id: 3c688b6bbc30d36af3ac34fdd4b7b5b787fe5555 $, with PDO
Server OS: Linux, apache2handler
Installed apps: content (2.8.32), assets (2.8.32), categories (2.8.32), perch_blog (5.0)
App runtimes: <?php $apps_list = array( 'content', 'categories', 'perch_blog', );
PERCH_LOGINPATH: /ifs-admin
PERCH_PATH: /var/www/public/ifstudies.dev/ifs-admin
PERCH_CORE: /var/www/public/ifstudies.dev/ifs-admin/core
PERCH_RESFILEPATH: /var/www/public/ifstudies.dev/ifs-admin/resources
Image manipulation: GD Imagick
PHP limits: Max upload 100M, Max POST 100M, Memory: 128M, Total max file upload: 100M
F1: 2edba60ed1f613d6dd804feb202456a2
Resource folder writeable: Yes
HTTP_HOST: ifstudies.dev
DOCUMENT_ROOT: /var/www/public/ifstudies.dev
REQUEST_URI: /ifs-admin/core/settings/diagnostics/
SCRIPT_NAME: /ifs-admin/core/settings/diagnostics/index.php
You can filter by
and
oror
but not both.Gotcha, thanks Drew. Any idea how I might achieve what I'm trying to do here?
You could do additional filtering in an
each
callback, perhaps.I'll give that a shot, thanks. Quick unrelated question...I've migrated from the blog app to collections and want to remove the blog. Other than deleting the perch_blog folder and removing it from apps.php, is there any other cleanup I should do? Just want to make sure the database isn't slowed down by the ~800 old blog posts.
You could drop the blog database tables too.
Ok, great, thanks. So it's safe to remove all of the perch2_blog* tables? Any other tables?
If you no longer need the data, yes.
Perfect, thanks again!