<?xml version="1.0" encoding="UTF-8"?>    <rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
      <channel>
        <title>Options Available for $searchOptions Array in Multi-Search</title>
        <link>https://interactivetools.com/forum/forum-posts.php?Options-Available-for-searchOptions-Array-in-Multi-Search-78474</link>
        <description></description>
        <pubDate>Mon, 13 Apr 2026 10:37:41 -0700</pubDate>
        <language>en-us</language>
        <atom:link href="https://interactivetools.com/forum/forum-posts.php?rss=1&amp;Options-Available-for-searchOptions-Array-in-Multi-Search-78474" rel="self" type="application/rss+xml" />

                <item>
          <title>Options Available for $searchOptions Array in Multi-Search</title>
          <link>https://interactivetools.com/forum/forum-posts.php?postNum=2229852#post2229852</link>
          <description><![CDATA[<p>Hi,</p>
<p>This behavior isn't available by default, but you can make a quick modification to the CMS Builder code to add it. If you open cmsAdmin/lib/viewerFunctions.php and add this code around line 1179:</p>
<p><code>    $where            = _addWhereConditionsForSpecialFields($schema, '', $searchOptions);<br /><br /><span style="color:#008000;">    if(@$tableOptions['customWhere']){</span><br /><span style="color:#008000;">      if($where){</span><br /><span style="color:#008000;">        $where .= "AND ".$tableOptions['customWhere'];</span><br /><span style="color:#008000;">      }else{</span><br /><span style="color:#008000;">        $where = 'WHERE '.$tableOptions['customWhere'];</span><br /><span style="color:#008000;">      }</span><br /><span style="color:#008000;">    }</span><br /><br />    $subquery         = "SELECT '$tablename' as `tablename`, num, `{$tableOptions['titleField']}` as `_title`, ";</code></p>
<p>Now you have the option to add custom where statements for each table search, here is an example of how you might use it:</p>
<p><code>$searchOptions = array(); <br />$searchOptions['keywords'] = @$_REQUEST['q']; <br />$searchOptions['perPage'] = "15"; <br />$searchOptions['debugSql'] = "0"; <br /><br />$searchTables = array(); <br /><br />$searchTables['blog'] = array( <br />'viewerUrl'    =&gt; 'index.php', <br />'titleField'   =&gt; 'title', <br />'summaryField' =&gt; 'title', <br />'searchFields' =&gt; array('title'), <br /><span style="color:#008000;">'customWhere'  =&gt; "published = '1'"</span><br />); <br /><br /><br />$searchTables['test_1'] = array( <br />'viewerUrl'    =&gt; 'history.php', <br />'titleField'   =&gt; 'title', <br />'summaryField' =&gt; 'title', <br />'searchFields' =&gt; array('title','content'), <br />); <br /><br /><br />list($searchRows, $searchDetails) = searchMultipleTables($searchTables, $searchOptions);</code></p>
<p>So when a search is carried out on the blog table, only records with the published checkbox selected will be returned.</p>
<p><strong>Note</strong>: This change requires the modification of core CMSB files, if you upgrade at a later date these changes will be lost.</p>
<p>Let me know if you have any questions.</p>
<p>Thanks!</p>
<p>Greg</p>]]></description>
          <pubDate>Fri, 15 Mar 2013 10:38:51 -0700</pubDate>
          <guid isPermaLink="true">forum-posts.php?postNum=2229852#post2229852</guid>
        </item>
                <item>
          <title>Options Available for $searchOptions Array in Multi-Search</title>
          <link>https://interactivetools.com/forum/forum-posts.php?postNum=2229847#post2229847</link>
          <description><![CDATA[<p>I also only would like an additional where clause "where publish=1", is this possible?</p>]]></description>
          <pubDate>Fri, 15 Mar 2013 07:48:02 -0700</pubDate>
          <guid isPermaLink="true">forum-posts.php?postNum=2229847#post2229847</guid>
        </item>
                <item>
          <title>Options Available for $searchOptions Array in Multi-Search</title>
          <link>https://interactivetools.com/forum/forum-posts.php?postNum=2229410#post2229410</link>
          <description><![CDATA[<p>Thanks, Greg. This helps a lot. :)</p>]]></description>
          <pubDate>Mon, 11 Feb 2013 05:43:48 -0800</pubDate>
          <guid isPermaLink="true">forum-posts.php?postNum=2229410#post2229410</guid>
        </item>
                <item>
          <title>Options Available for $searchOptions Array in Multi-Search</title>
          <link>https://interactivetools.com/forum/forum-posts.php?postNum=2229396#post2229396</link>
          <description><![CDATA[<p>Hi Jessica,</p>
<p>Sorry for the delay in reply.</p>
<p>The searchMultipleTables function is currently an experimental feature with limited functionality, the only filter option it currently has is for keywords.</p>
<p>The searchMultipleTables function collects results in the order the table items are added to the array. For example:</p>
<p><code>$searchTables['news'] = array(<br />  'viewerUrl' =&gt; 'multiSearch.php',<br />  'titleField' =&gt; 'title',<br />  'summaryField' =&gt; 'content',<br />  'searchFields' =&gt; array('title','content'),<br /> );<br /><br /> $searchTables['blog'] = array(<br />  'viewerUrl' =&gt; 'multiSearch.php',<br />  'titleField' =&gt; 'title',<br />  'summaryField' =&gt; 'content',<br />  'searchFields' =&gt; array('title','content'),<br /> );</code></p>
<p><br />Would collect news results, then blog results. If you reordered them like this:</p>
<p><code>$searchTables['blog'] = array(<br /> 'viewerUrl' =&gt; 'multiSearch.php',<br /> 'titleField' =&gt; 'title',<br /> 'summaryField' =&gt; 'content',<br /> 'searchFields' =&gt; array('title','content'),<br /> );<br /><br /> $searchTables['news'] = array(<br />  'viewerUrl' =&gt; 'multiSearch.php',<br />  'titleField' =&gt; 'title',<br />  'summaryField' =&gt; 'content',<br />  'searchFields' =&gt; array('title','content'),<br /> );</code></p>
<p>Then blog results would be collected first. So I would put sections that people are most likely to want results from at the top of the list, and least likely at the bottom.</p>
<p>There are currently only 4 searchOptions you can use in the searchMultipleTables function, the final one being the orderBy option. You can use this to as you would the orderBy function in a getRecords function. For example:</p>
<p><code>//NOTE: Because of a bug you always need to have a space at the end of the string.<br /> $searchOptions['orderBy'] = "_title DESC ";</code></p>
<p>Would return results from each section ordered by there title. </p>
<p>There is a bug in the orderBy functionality that means you will need to add a space at the end of the string.</p>
<p>Let me know if you have any questions.</p>
<p>Thanks!</p>
<p>Greg</p>]]></description>
          <pubDate>Fri, 08 Feb 2013 10:35:32 -0800</pubDate>
          <guid isPermaLink="true">forum-posts.php?postNum=2229396#post2229396</guid>
        </item>
                <item>
          <title>Options Available for $searchOptions Array in Multi-Search</title>
          <link>https://interactivetools.com/forum/forum-posts.php?postNum=2229388#post2229388</link>
          <description><![CDATA[<p>Just hoping to get a response. I have a client asking about it for their site, because the results are showing up in a strange place.</p>
<p>If it helps:</p>
<p><a href="http://test.suffolkfcu.org/" rel="nofollow">http://test.suffolkfcu.org/</a></p>
<p>If you type in a search for 'savings' with no quotes, the personal savings account page (which is the one most likely to be looked for) doesn't come up until page two. If I add personal or account or even both, it doesn't seem to help narrow the results to that page. Most of the searches seem to be working this way.</p>]]></description>
          <pubDate>Thu, 07 Feb 2013 14:20:09 -0800</pubDate>
          <guid isPermaLink="true">forum-posts.php?postNum=2229388#post2229388</guid>
        </item>
                <item>
          <title>Options Available for $searchOptions Array in Multi-Search</title>
          <link>https://interactivetools.com/forum/forum-posts.php?postNum=2229354#post2229354</link>
          <description><![CDATA[<p>I have a, hopefully, quick question.</p>
<p>For a multi-search, there's this piece of code to put on the list page.</p>
<p><code>$searchOptions = array();<br />$searchOptions['keywords'] = @$_REQUEST['q'];<br />$searchOptions['perPage'] = "10";<br />$searchOptions['debugSql'] = "0";</code></p>
<p>I was wondering if there were any other options that could be put in this array and what they were, if they're pre-defined anywhere. Ideally, I was hoping to take 'keywords' and maybe use 'query'. Similar to how the difference between a _keyword search and a _query search work using the URL method for a single table list viewer. Right now, the search returns a massive list of results that I'm hoping to narrow down by allowing someone to add keywords to the search field, like using an 'AND' instead of an 'OR'.</p>
<p>I'm also wondering if there's an "ORDER BY" option. It feels like the results are being displayed in a strange order.</p>
<p>Thanks in advance! :)</p>]]></description>
          <pubDate>Tue, 05 Feb 2013 13:40:04 -0800</pubDate>
          <guid isPermaLink="true">forum-posts.php?postNum=2229354#post2229354</guid>
        </item>
              </channel>
    </rss>
  