Hello!
I have found that in "quick search", the words are also matched to categories.comments. If the searched word is found in this field, then the results include , in addition, all the items of this category. How can I avoid this?
Ex: CATEGORIES.COMMENT
ID, DATE_LAST, NB_IMAGES, NAME, ID_UPPERCAT, COMMENT, ...
9, '2008-10-08 18:23:46', 559, 'Ferretería', , 'Referencias de artículos generales para la ferretería doméstica ( ensamblajes, CUELGAFACIL, imanes, llaveros, candados,...)', ...
SELECT id, name, permalink, nb_images
FROM categories
INNER JOIN user_cache_categories ON id=cat_id
WHERE user_id=1
AND MATCH(name, comment) AGAINST( "cuelgafacil" IN BOOLEAN MODE)
(**Word "CUELGAFACIL" is found in in "comment" field of category number 9 **)
SELECT DISTINCT(id)
FROM images i
INNER JOIN image_category AS ic ON id = ic.image_id
WHERE (i.id IN (1070,1068,1067,1066,1065)<---- Id's correspondig to my quick search of "Cuelgafacil": OK!
OR category_id IN (9)) <-------------------------------- I want to avoid this restriction!!
AND 1 = 1
ORDER BY date_available DESC, file ASC, id ASC
I hope I have explained my problem correctly. Thanks for your help!
Last edited by manute (2008-11-17 15:51:16)
Offline
What version of MySql ?
Version of MySql > in 4.1 works for quick search.
Offline
The version number of MySQL is 4.1.2. But , anyway, I think it is not a MySQL version issue. I 'd like to know if the word typed in "quick search" may not be searched (or matched) in Categories.comment.
Offline
Hi, again!
I have done the following change in functions_search.inc.php:
// Step 3 - search categories corresponding to the query $q ==================
global $user;
$query = '
SELECT id, name, permalink, nb_images
FROM '.CATEGORIES_TABLE.'
INNER JOIN '.USER_CACHE_CATEGORIES_TABLE.' ON id=cat_id
WHERE user_id='.$user['id']
// AND MATCH(name, comment) AGAINST( "'.$q.'" IN BOOLEAN MODE)'.
.' AND MATCH(name) AGAINST( "'.$q.'" IN BOOLEAN MODE)'. <------ !!!
get_sql_condition_FandF (...
...
And it seems to work like I want.
Thank you.
Regards
Last edited by manute (2008-11-17 16:40:57)
Offline