You are here:  » html in description + search on plural

Support Forum



html in description + search on plural

Submitted by pat on Tue, 2007-07-31 20:07 in

Hello David

I cant' get the script to search on plural words in names and description, it searches and brings results only on singular words.

I already have the modif with "ft_namedescription on products (name,description);"

I can't get the way to have <BR> in my descriptions despite the modif I made on admin.php... (www.pricetapestry.com/node/520)

even if i delete the whole block of code as you said, it still can't have to work

Any idea?

Thanks

Pat

Submitted by support on Tue, 2007-07-31 20:34

Hi Pat,

Did you re-import the feed after making the modification? The code removes the HTML during the import process so the change won't have any effect until the feed is imported again.

Regarding not being able to search on plural words, do you mean that if searching for a singular word you do not get results for products that only contain that word in the plural? The full text indexing features of MySQL does not have any specific support for recognising words that have plural counterparts, so the only way to support this would be a similar modification to that shown in the following thread which handles the opposite situation:

http://www.pricetapestry.com/node/617

An alternative modification to that shown is as follows:

          $words = explode(" ",$parts[0]);
          $newWords = array();
          foreach($words as $word)
          {
            $newWords[] = $word."s";
          }
          $allWords = array_merge($words,$newWords);
          $parts[0] = implode($allWords," ");

This will take every term in the query, and add an "s", making the plural version and then including that in the search...!

Hope this helps,
Cheers,
David.

Submitted by pat on Tue, 2007-07-31 22:35

I got it to work for the html in description field (my mistake I had the file in a wrong folder) but the search is strange, in fact it does search on plural but not on singular ...

my site is about garden fountains, I have the word "fountain" all over the pages but if i search "fountain" i end up with "no result" while I have tons of results for "fountains" or "wall fountain"...

Also I can't limit the description to a specific amount of caracters, the code to limit the description in html/searchresults.php as indicated at (www.pricetapestry.com/node/923) doesn't do anything, and in products.php I don't find :

if ($product["description"])
{
print "".$product["description"]."";
}

as explain at www.pricetapestry.com/node/98. I have pages with description longer than my Christmas list... so i really need to shorten that.

I do re-import the feed every time i make a modif..

Pat

Submitted by support on Wed, 2007-08-01 08:07

Hi Pat,

The thread you referred to regards a very early version of Price Tapestry. To limit the amount of description text displayed on the products page, you would need to make the change in html/product.php. Look for the following code (line 13):

<p><?php print $mainProduct["description"]; ?></p>

...and change this to:

<p><?php print substr($mainProduct["description"],0,250); ?></p>

(where 250 is the character limit you wish to have)

Regarding your plural search issue, as your site is dedicated to fountains it is probably the case that the full text index has excluded the word "fountain" from the index because it appears in too many records. In other words, it considers it to be irrelevant in the same way that words like "the" and "and" are no indexed. To resolution to this is to revert to the normal search method for all queries, not just those under 4 characters in length. To do this, look for the following code in search.php (line 63):

if (strlen($parts[0]) > 3)

...and change this as follows:

if (0)

This will force the full word search for every query.

Hope this helps,
Cheers,
David.

Submitted by pat on Wed, 2007-08-01 11:48

Thanks you very very much, everything is working just fine

thanks again for your help

Pat