First I want to say thanks for your great search component.I think it is a must-have package of Umbraco.
When I using it on my site, I found a issue with the surround() function.
For example, search for 'a s' (which means 'a' and 's'), the descriptions of the search results will break.
The word 'Bag' in description will become B<<strong>s</strong>trong>a</<strong>s</strong>trong>g. I guess that is because the surround() function replaces the 's' character with <strong>s</strong> recursively.
Windows XP Sp3 / UltraDev Cassini 2.0 / ASP.net 2.0 / Umbraco 4.0.2.1
I have wrote a fix for the issue. The fix is based on an assumption that there are no '\x01' and '\x02' characters in search phase and description of search result. Wish it helps.
Regards,
Wayne
public string surround(string data, string find, string before, string after) { // strong marks string s = "\x01"; string e = "\x02";
// searches for find within data, then surrounds it with before and after tags // note: replace with the actual text found, to preserve the case
string nextWord = getFirstElement(find, " "); string remainingWords = find; while (nextWord != "") { int index = data.ToLower().IndexOf(nextWord.ToLower()); while (index > -1) { string replacement = s + data.Substring(index, nextWord.Length) + e; data = data.Substring(0, index) + replacement + data.Substring(index + nextWord.Length); index = data.ToLower().IndexOf(nextWord.ToLower(), index + replacement.Length); } remainingWords = removeFirstElement(remainingWords, " "); nextWord = getFirstElement(remainingWords, " "); } return data.Replace(s, before).Replace(e, after); }
Maybe a bug in surround()
Hi Douglas,
First I want to say thanks for your great search component.I think it is a must-have package of Umbraco.
When I using it on my site, I found a issue with the surround() function.
For example, search for 'a s' (which means 'a' and 's'), the descriptions of the search results will break.
The word 'Bag' in description will become B<<strong>s</strong>trong>a</<strong>s</strong>trong>g. I guess that is because the surround() function replaces the 's' character with <strong>s</strong> recursively.
Windows XP Sp3 / UltraDev Cassini 2.0 / ASP.net 2.0 / Umbraco 4.0.2.1
Sorry, forget to say the issue is with the XSLTSearch 2.8.
Thanks for the bug report. I'll check into it!
cheers,
doug.
I have wrote a fix for the issue. The fix is based on an assumption that there are no '\x01' and '\x02' characters in search phase and description of search result. Wish it helps.
Regards,
Wayne
is working on a reply...