• Welcome to Simple Machines Community Forum. Please login or sign up.
January 18, 2022, 08:25:07 PM

News:

Join the Facebook Fan Page.


Broken search result

Started by Sir Osis of Liver, November 19, 2021, 09:50:40 PM

Previous topic - Next topic

Sir Osis of Liver

Search returns borked topic title, split <strong> tags, only on this topic. Can't find it. >:(
"The best laid schemes o' mice an' men / Gang aft a-gley." - Robert Burns

Sir Osis of Liver

Thanks for all the suggestions. :P  Having studied this further, am able to replicate the glitch on test install.  The original topic is here, if you search the title 'The Mill on the Floss' from home page, you'll see the result 'The ong class="highlight">Millong> on the Floss'.  The problem is the title, if it's in a child board and contains 'll on', search result is scrambled.  Any title string that includes 'l on ' (i.e., testl on test) will search badly.  This appears to be a very obscure bug in the search function.
"The best laid schemes o' mice an' men / Gang aft a-gley." - Robert Burns

Sir Osis of Liver

It's in Search.php -


/// search glitch original
// $subject_highlighted = preg_replace('/(' . preg_quote($query, '/') . ')/i' . ($context['utf8'] ? 'u' : ''), '<strong class="highlight">$1</strong>', $subject_highlighted);

/// search glitch fix
$subject_highlighted = preg_replace('/(' . preg_quote($query, '/') . ')/i' . ($context['utf8'] ? 'u' : ''), '<span class="highlight">$1</span>', $subject_highlighted);


The <strong> tags are redundant, .highlight class includes bold -


/* Highlighted text - such as search results. */
.highlight
{
font-weight: bold;
color: #ff7200 !important;
font-size: 1.1em;
}


Don't know why it breaks the string, but corrected code seems to fix it.
"The best laid schemes o' mice an' men / Gang aft a-gley." - Robert Burns

live627

A similar bug has come up before which triggered the highlighting algorithm to be redone in 2.1.

Sir Osis of Liver

Is 2.0 still getting bug fixes?
"The best laid schemes o' mice an' men / Gang aft a-gley." - Robert Burns

Aleksi "Lex" Kilpinen

Quote from: Sir Osis of Liver on November 24, 2021, 10:25:05 PMIs 2.0 still getting bug fixes?
Currently, we are actually aiming to fix some of the more visible bugs in .18 with our next patch, but on a general level 2.1 takes priority.
A Finnish Project Manager (Support Specialist)
 Happily running multiple SMF 2.x installations.
  Fooling around with i7-10700 @ 2,90GHz-4.80GHz / 16Gb / RTX-2070 Super / 3840x2160 / Win 10 x64


How you can help SMF

"Before you allow people access to your forum, especially in an administrative position, you must be aware that that person can seriously damage your forum. Therefore, you should only allow people that you trust, implicitly, to have such access." -Douglas

Advertisement: