Page 1 of 1
Webhelp indexterm search is slow - how to optimize?
Posted: Wed May 30, 2018 6:18 pm
by DrStrangelove
We are using Oxygen 19.1 and WebHelp Classic. We are finding that the indexterm search is quite slow, and were wondering if there's a way to speed it up. This is the search from the "Index" tab. When you type a word into the search box, the word does not appear in the box for about 8-10 seconds, and then finally the word appears in the box and the results are displayed. This doesn't seem to have anything to do with the browser or the network.
Re: Webhelp indexterm search is slow - how to optimize?
Posted: Thu May 31, 2018 4:06 pm
by ionela
Hello,
We are not aware of any issues with the filter index feature in the WebHelp Classic output for moderate size documentation projects. Could you please try to reproduce this issue on our user-guide and check if the search is slow:
https://www.oxygenxml.com/doc/versions/17.1/ug-editor
Regards,
Ionela
Re: Webhelp indexterm search is slow - how to optimize?
Posted: Thu May 31, 2018 4:37 pm
by DrStrangelove
Hi Ionela, the help on your web site works fine. What do you consider a moderately sized project? Our output from the Web Help Classic transformation is 70.9 MB, and has 4848 files in 782 folders.
Re: Webhelp indexterm search is slow - how to optimize?
Posted: Tue Jun 05, 2018 4:35 pm
by DrStrangelove
To Ionela Istodor , can you tell me what is considered a medium-size project? At what size is the index lookup expected to degrade, and is there a way to remediate it?
Re: Webhelp indexterm search is slow - how to optimize?
Posted: Wed Jun 06, 2018 11:52 am
by ionela
Hi,
We have re-analyzed this issue with our development team and we have a performance improvement that will become available in the next version of
oXygen XML (the indexterm list filtering will be optimized). To apply the fix in version
19.1, you should edit the following file from
oXygen XML installation directory (before editing the original file it is recommended to create a backup of it, just to be safe):
Code: Select all
${DITA-OT-DIR}\plugins\com.oxygenxml.webhelp.classic\xsl\createMainFiles.xsl
Over there you need to replace the following code:
Code: Select all
<xsl:comment>
$(function () {
$('input#id_search').keyup(function(){
$("ul#indexList li").hide();
if ($("input#id_search").val() != '' ) {
var sk=$("input#id_search").val();
$('ul#indexList').removeHighlight();
$('ul#indexList').highlight(sk,"highlight");
$("div:contains('"+sk+"')").each(function(){
if ($(this).parents("#indexList").size()>0){
$(this).show();
$(this).parentsUntil('#indexList').show();
$(this).parent().find('ul').show();
if ($(this).find('a').size()==0){
$(this).parent().find('ul li').show();
}
}
});
}else{
$("ul#indexList li").show();
$('ul#indexList').removeHighlight();
}
});
});
</xsl:comment>
with:
Code: Select all
<xsl:comment>
$(function () {
var oldLength = 0;
var $input = $('input#id_search');
var timeout;
$input.keyup(function () {
clearTimeout(timeout);
timeout = setTimeout(function () {
var $indexList = $('ul#indexList');
var inputValue = $input.val();
if (inputValue != '' && inputValue.length >= oldLength) {
$indexList.find("li:visible").filter(function () {
return $(this).text().indexOf(inputValue) == -1;
}).addClass('hide');
oldLength = inputValue.length;
$indexList.removeHighlight();
$indexList.highlight(inputValue);
return;
}
if (inputValue != '' && inputValue.length < oldLength) {
$indexList.find("li:hidden").filter(function () {
return $(this).text().indexOf(inputValue) != -1;
}).removeClass('hide');
oldLength = inputValue.length;
$indexList.removeHighlight();
$indexList.highlight(inputValue);
return;
}
if (inputValue == '') {
$indexList.find("li:hidden").removeClass('hide');
oldLength = 0;
$indexList.removeHighlight();
return;
}
oldLength = inputValue.length;
return;
}, 200);
});
});
</xsl:comment>
I hope this helps.
Regards,
Ionela
Re: Webhelp indexterm search is slow - how to optimize?
Posted: Wed Jun 06, 2018 6:29 pm
by DrStrangelove
Thank you for looking into this. The new code is a BIG improvement!
FYI, there were some character sequences that were not valid in XML, so I had to use CDATA.
The two changed lines are:
Code: Select all
if (inputValue != '' <![CDATA[&&]]> inputValue.length >= oldLength) {
and
Code: Select all
if (inputValue != '' <![CDATA[&&]]> inputValue.length <![CDATA[<]]> oldLength) {