Author Topic: how to change from fulltext search(match against) to other search(LIKE) query?  (Read 1867 times)


  • Newbie
  • *
  • Posts: 6
Hi folks,

My web hosting provide told me they can not change the ft_min_word_len value since it will effect the everyone on that shared server. This is a huge problem for me because it limits the minimum allowed search keyword length to 3 but I need a min length of 2.

I've been searching for the workaround on this but unfortunately I left with only solution that I need to alter the core source of OSClass.

In "oc-includes/osclass/model/Search.php" I found the following codes which I believe this is what I need to change. Original code is showing first and commented line is what I tried(not working properly). I want to use LIKE syntax instead of MATC H AGAINST in order to overcome the issue. could anyone check the following code and please let me know the solution?


line: 775
                $this->dao->where(sprintf("MATCH(d.s_title, d.s_description) AGAINST('%s' IN BOOLEAN MODE)", $this->sPattern));
      //$this->dao->where(sprintf("d.s_title LIKE '%%%s%%' OR d.s_description LIKE '%%%s%%'", $this->sPattern, $this->sPattern) );

line: 878
                    $this->dao->where(sprintf("MATCH(d.s_title, d.s_description) AGAINST('%s' IN BOOLEAN MODE)", $this->sPattern) );
      //$this->dao->where(sprintf("d.s_title LIKE '%%%s%%' OR d.s_description LIKE '%%%s%%'", $this->sPattern, $this->sPattern) );

                } else if(preg_match('/MATCH\(d\.s_title, d\.s_description\) AGAINST\(\'([\s\p{L}\p{N}]*)\' IN BOOLEAN MODE\)/u', $condition, $matches) ) { // OJO
      //} else if(preg_match('/d\.s_title\s*LIKE\s*\'%([\s\p{L}\p{N}]*)%\' OR \.s_description\s*LIKE\s*\'%([\s\p{L}\p{N}]*)%\'/u', $condition, $matches) ) { // OJO


  • issues
  • Hero Member
  • *
  • Posts: 1609
Hi. In osclass 3.7.1 I resolved the ft_min_word_len problem by changing all words with under 4 characters to 4 character ones by adding "_" at the end of the word for every missing character.
It works fine with ft_min_word_len=4.

I posted the solution here
« Last Edit: April 22, 2017, 11:55:20 am by marius-ciclistu »