News:

Want to get involved in developing SMF, then why not lend a hand on our github!

Main Menu

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. >:(
Ashes and diamonds, foe and friend,
 we were all equal in the end.

                                     - R. Waters

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.
Ashes and diamonds, foe and friend,
 we were all equal in the end.

                                     - R. Waters

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.
Ashes and diamonds, foe and friend,
 we were all equal in the end.

                                     - R. Waters

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?
Ashes and diamonds, foe and friend,
 we were all equal in the end.

                                     - R. Waters

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.
Slava
Ukraini!


"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

How you can help SMF

Advertisement: