Multisearch - Force Ignore records
2 posts by 2 authors in: Forums > CMS Builder
Last Post: February 23, 2016 (RSS)
Hello, All -
Is it possible to force Multisearch to ignore records?
I want to prevent the search from returning records which have a particular value set. The search code looks like this:
$searchTables = array();
$searchTables['pages'] = array(
'viewerUrl' => 'index.php',
'titleField' => 'name',
'summaryField' => 'content',
'field3' => 'permalink',
'field4' => 'onNav',
'searchFields' => array('name','content','footnote'),
);
I want the search to ignore records which have the "onNav" value of "0" (checkbox).
I can do this on the list page by filtering the results:
<?php if(@$listRecord['field4'] == "0") {continue;} ?>
...but it's ugly - especially as the number of results indicated in the search info will be higher than those listed on the page!
What can I do?
:0/
Perchpole
Hey Perch,
I found this post:
http://www.interactivetools.com/forum/forum-posts.php?postNum=2229852#post2229852
Which explains how to add a custom where statement into the multi search system. This does involve modifying core CMSB code, so we can't provide support if it causes any issues,but it should allow you to add a filter for the pages section. You could add a where statement to ignore records with onNav set to zero:
'customWhere' => "onNav = '1'"
Cheers,
Greg
PHP Programmer - interactivetools.com