View Full Version : Partial (substring) matching of custom metadata
AndrewD
12-28-2008, 03:23 PM
I have set up a custom metafield as type text, partial (substring) matching. I'm probably missing something blindlingly obvious, but I only get matches when I provide a full character string.
For example, the author custom field for a file is set to Stephen Jones. This file is picked up correctly when "Stephen Jones" is entered into the custom search field but not when I enter Jones.
wrensoft
12-28-2008, 07:42 PM
When you set up the custom meta fields in the Zoom configuration panel, there is an option to have text fields match only when there is an "exact match" or when there is a "partial substring match".
AndrewD
12-29-2008, 08:17 AM
When you set up the custom meta fields in the Zoom configuration panel, there is an option to have text fields match only when there is an "exact match" or when there is a "partial substring match".
I have these fields set to partial substring match, but only seem able to match full strings.
wrensoft
12-29-2008, 08:24 PM
What scripting option are you using? ASP, PHP, JS, or CGI?
What is the URL for your search function so we can see the problem?
AndrewD
12-30-2008, 02:30 PM
What scripting option are you using? ASP, PHP, JS, or CGI?
What is the URL for your search function so we can see the problem?
I've sent you an email with site information and various files.
wrensoft
12-30-2008, 11:35 PM
There is a bug in the PHP script, it seems, with partial matching on custom meta text fields. At the moment it is effectively doing an exact string match. If you edit your existing search.php script and replace the mystristr function with the code below, it should fix the problem. We'll include this fix into the mid Jan release.
function mystristr($word1, $word2)
{
global $UseUTF8;
global $UseMBFunctions;
if ($UseUTF8 == 1 && $UseMBFunctions == 1) {
if (preg_match('/^[\x80-\xff]/', $word1) || preg_match('/^[\x80-\xff]/', $word2))
return strstr(mb_strtolower($word1, "UTF-8"), mb_strtolower($word2, "UTF-8"));
else
return stristr($word1, $word2);
}
else
return stristr($word1, $word2);
}
The same issue might also effect the CGI script. We still need to check.
Also there is another bug, It seems numeric meta fields are not being picked up in .desc files, but are being picked up from HTML files. Changing the year field to a text field in the Zoom configuration might be a suitable work around for the moment. Again we'll fix this up for the mid Jan release.
These bugs will be fixed for the upcoming V6.0 build 1005 release scheduled to be made available in the next few days.
When it is ready, you will find it available for download here:
http://www.wrensoft.com/zoom/whatsnew.html
Powered by vBulletin® Version 4.1.12 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.