Webhelp indexterm search is slow - how to optimize?

Having trouble installing Oxygen? Got a bug to report? Post it all here.
DrStrangelove
Posts: 18
Joined: Thu Jan 25, 2018 11:21 pm

Webhelp indexterm search is slow - how to optimize?

Post 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.
ionela
Posts: 402
Joined: Mon Dec 05, 2011 6:08 pm

Re: Webhelp indexterm search is slow - how to optimize?

Post 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
Ionela Istodor
oXygen XML Editor and Author Support
DrStrangelove
Posts: 18
Joined: Thu Jan 25, 2018 11:21 pm

Re: Webhelp indexterm search is slow - how to optimize?

Post 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.
DrStrangelove
Posts: 18
Joined: Thu Jan 25, 2018 11:21 pm

Re: Webhelp indexterm search is slow - how to optimize?

Post 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?
ionela
Posts: 402
Joined: Mon Dec 05, 2011 6:08 pm

Re: Webhelp indexterm search is slow - how to optimize?

Post 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
Ionela Istodor
oXygen XML Editor and Author Support
DrStrangelove
Posts: 18
Joined: Thu Jan 25, 2018 11:21 pm

Re: Webhelp indexterm search is slow - how to optimize?

Post 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) {
Post Reply