Announcement

  •  » Requests
  •  » Avoid "quick search" to match words in Categories.Comments

#1 2008-11-17 13:31:19

manute
Member
2008-06-12
13

Avoid "quick search" to match words in Categories.Comments

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

 

#2 2008-11-17 13:41:02

ddtddt
Piwigo Team
Quetigny - France
2007-07-27
7207

Re: Avoid "quick search" to match words in Categories.Comments

What version of MySql ?

Version of MySql > in 4.1 works for quick search.


You love Piwigo so don't hesitate to participate, learn more on the "Contribute to Piwigo" page. If you don't have much time for contribution, you can also help the project with a donation.

Offline

 

#3 2008-11-17 15:42:49

manute
Member
2008-06-12
13

Re: Avoid "quick search" to match words in Categories.Comments

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

 

#4 2008-11-17 16:37:19

manute
Member
2008-06-12
13

Re: Avoid "quick search" to match words in Categories.Comments

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

 
  •  » Requests
  •  » Avoid "quick search" to match words in Categories.Comments

Board footer

Powered by FluxBB

github twitter newsletter Donate Piwigo.org © 2002-2024 · Contact