CMS MADE SIMPLE FORGE

CMS Made Simple Core

 

[#7538] Search Module removes valid words when indexing.

avatar
Created By: Bob Sideshow (sideshowbob)
Date Submitted: Mon Jan 30 12:37:36 -0500 2012

Assigned To: Tapio Löytty (Stikki)
Version: 1.10.2
CMSMS Version: 1.10.2
Severity: Minor
Resolution: Accepted
State: Open
Summary:
Search Module removes valid words when indexing.
Detailed Description:
CMSMS V 1.10.3

File /modules/search/search.tools.php line 22 (function search_StemPhrase)

The line
$phrase = preg_replace('/{.*}/', '', $phrase); 
is supposed to only strip smarty tags but it doesn't.

I think it should be replaced with:
$phrase = preg_replace('/{.+?}/', '', $phrase);
However, I'm no regex expert so there may be a better way.

Consider this text:
<p>Apples, bananas, carrots, <a href="{cms_selflink href="somepage"}">click
this</a> dewberry, eggs <a href="{cms_selflink href="somepage"}">click this
too</a> flowers, grapefruit</p>

The result using the current code is:
<p>Apples, bananas, carrots, <a href="">click this too</a> flowers,
grapefruit</p>

The result using the revised code is:
<p>Apples, bananas, carrots, <a href="">click this</a> dewberry, eggs <a
href="">click this too</a> flowers, grapefruit</p>

As you can see, more data is being removed than intended.


History

Updates

Updated: 2012-09-07 15:15
resolution_id: 5 => 6

Updated: 2012-04-14 15:52
resolution_id: => 5
assigned_to_id: 100 => 11306