Support forum login

©2006-2016 IAAI Software

Contact Us Privacy Policy

Support Plus

Search query

Submitted by wesse249 on Thu, 2016-01-07 22:02.

Hello David,

When i search for the word "inlegzooltjes" on my website i find products: http://example.com/search.php?q=inlegzooltjes

But when i search for "inlegzooltje" (withous last S) nothing is found. I there a solutions that with both words the products are found?

Thanks Jan Roel

Submitted by support on Fri, 2016-01-08 09:32.

Hello Jan,

Sure - there is already code in place to do the reverse (stemming) so that if somebody searches in the plural the singular word is also included in the search but you can always include the opposite at the same point. In search.php look for the following code beginning at line 263:

  if (substr($word,-1)=="s")
  {
    $newWords[] = substr($word,0,-1);
  }

...and REPLACE with:

  if (substr($word,-1)=="s")
  {
    $newWords[] = substr($word,0,-1);
  }
  else
  {
    $newWords[] = $word."s";
  }

Cheers,
David.
--
PriceTapestry.com

Submitted by wesse249 on Fri, 2016-01-08 22:05.

Hello David,

Is it possible to add an extra option?

When i search for "buikband" i find products: {link saved}

When i search for "buikbanden" i find nothing: {link saved}

So is it possible to add the extra option of "en" with or without.

Thanks Jan Roel

Submitted by support on Sat, 2016-01-09 11:07.

Hello Jan,

Sure - extend the above REPLACEment as follows;

  if (substr($word,-1)=="s")
  {
    $newWords[] = substr($word,0,-1);
  }
  else
  {
    $newWords[] = $word."s";
  }
  if (substr($word,-2)=="en")
  {
    $newWords[] = substr($word,0,-2);
  }
  else
  {
    $newWords[] = $word."en";
  }

Cheers,
David.
--
PriceTapestry.com

Submitted by wesse249 on Sat, 2016-01-23 09:34.

Hello David,

I was wondering if it is possible to add extra searchwords to a category or use words which i wrote by altenatives in category mapping. When i can use these words it's also easy to add more searchwords..

Thank you ,

Jan Roel

Submitted by support on Sat, 2016-01-23 09:54.

Hello Jan,

I would only recommend this for a very niche site however since you already have this modification in place to set the category field to the subcategory name from the hierarchy, you could include a single WHERE clause with a sub-select against the categories_hierarchy table to see if the whole query matches anything in your alternative lists. To give it a go, edit search.php and look for the following code at line 239:

      default:

...and REPLACE with:

      default:
        $priceWhere .= " OR category IN (SELECT name FROM
                         `".$config_databaseTablePrefix."categories_hierarchy`
                         WHERE alternates LIKE '%".database_safe($q)."%')";

(if not using Category Hierarchy Mapping the above will work with normal Category Mapping without any further modifications simply by replacing "categories_hierarchy" with just "categories")

Cheers,
David.
--
PriceTapestry.com