More Search Function Questions

14 posts by 7 authors in: Forums > CMS Builder
Last Post: October 18, 2010   (RSS)

By Mikey - September 12, 2010

Dave
I'm having the same issue as InHouse on one of my web sites:
(1 - My search responses using the 'multisearch' option seem to be case sensitives. Can anyone point me in the direction of making it case insensitive?)

Is there a solution that can be posted in this thread to help those of use having the case sensitive issues with multiSearch.php ? I've used the multiSearch.php on a couple of web sites I've built. On one web site it works perfectly and is not case sensitive... on the other web site it only returns case sensitive results only. The code I've used on both sites is practically identical other than the records it checks during the search, therefore I'm quite certain it's a setting on my server that may be causing the one site to be case sensitive during multiSearch.php queries.

Is there a .htaccess mod rewrite I could use to to make the multiSearch.php be case insensitive or is there something you can suggest to help me make my search engine case insensitive?

The .htaccess I've got loaded now is:

RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^(.+)$ $1.php [L,QSA]

I tried adding [NC] to this as seen below, but it didn't help:
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^(.+)$ $1.php [NC,L,QSA]

Hi J,

It shouldn't be case sensitive as it uses the MySQL "LIKE" function which is case-insensitive. If you can send me CMS and FTP login details to dave@interactivetools.com I could check it out for you. (Email, don't post login details to the forum).

As for multisearch, it's fairly limited. If you want to tell me about what you're trying to do via email we can see if it can be easily extended for what you need.

Hope that helps!

Re: [zickey] More Search Function Questions

By Chris - September 12, 2010 - edited: September 12, 2010

Hi zickey,

Can you make sure your field list ends with "_keyword"?

For example, the last field in this list is "contact_name":

<input type="text" name="region,primary_community,location,start,description,sponsor,contact_name_keyword" ...

The correct format is:

FIELD,FIELD,FIELD,...,FIELD_keyword

If that doesn't help, please post your <FORM> code and your getRecords() code.
All the best,
Chris

Re: [zick] More Search Function Questions

By Jason - October 18, 2010

Hi Zickey,

Since you're only searching against 1 table, you won't need to use the searchMultipleTables() function. You could try searching like this:

list($resultRecords,$resultMetaData) = getRecords(array(
'tableName' => 'events',
'allowSearch' => false,
'perPage' => 10,
'where' => "LOWER(title) LIKE '%".mysql_escape(strtolower(@$_REQUEST['q']))."%' OR LOWER(date) LIKE '%".mysql_escape(strtolower(@$_REQUEST['q']))."%' OR LOWER(content) LIKE '%".mysql_escape(strtolower(@$_REQUEST['q']))."%' OR LOWER(description) LIKE '%".mysql_escape(strtolower(@$_REQUEST['q']))."%' OR LOWER(category) LIKE '%".mysql_escape(strtolower(@$_REQUEST['q']))."%'",
));


This code will convert everything to lowercase before doing the search.

Hope this helps.
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/