Author Topic: multi-word search in 1.7.8  (Read 10243 times)

0 Members and 1 Guest are viewing this topic.

Offline fitterashes

  • Newbie
  • *
  • Posts: 30
    • View Profile
multi-word search in 1.7.8
« on: September 29, 2010, 08:37:28 PM »
Hello,

I don't know if this issue is related to the last update or my configuration, but i just noticed a problem with the search engine and the keywords :

- Search with a single word works fine (ie : houston)
- Search with 2 words (space separated) = Your search resulted in no matching records. (ie : houston washington)
- Search with 2 words using AND, OR, NOT = Your search resulted in no matching records. (ie:  houston AND washington)

- Search with 2 words seperated by a comma = works fine, same as using "OR" (ie:  houston,washington)
- Search with 2 words using comma + AND = works fine (ie : houston,AND,washington)

So there's a bug with space and commas i guess, any help to fix that please ?
nb : I use the last version 1.7.8, I did the keyword migration, and i have unmodified search.php and search_utils.php

Thank you

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: multi-word search in 1.7.8
« Reply #1 on: September 30, 2010, 02:41:21 AM »
Yes, it's a bug.

Please test this. In includes/search_utils.php find:

  $split_words preg_split("/,+/"$val);

Replace it with:
  if ($for_search)
  {
    
$split_words preg_split("/\s+/"$val);
  }
  else
  {
    
$split_words preg_split("/,+/"$val);
  }
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline fitterashes

  • Newbie
  • *
  • Posts: 30
    • View Profile
Re: multi-word search in 1.7.8
« Reply #2 on: September 30, 2010, 03:59:56 PM »
seems to be ok now, Thank you  :wink: