Page 1 of 1

Help me understand webhelp responsive search

Posted: Fri Dec 13, 2019 1:28 pm
by revaljilji
Hello,

for our company it is very important to have a functional search. There is a lot of parameters that contain special characters ($, #, %, etc..) and we are not able to find them because webhelp search doesn't support it. So I'm trying to figure out why and how your search works? For example upon writing \word or *word, search automatically deletes the character, while $word will stay the same? Could you please explain the logic behind it? I would also like to know if its possible to enable the search for the special characters?

BR,
R

Re: Help me understand webhelp responsive search

Posted: Tue Dec 17, 2019 6:28 pm
by radu_pisoi
Hi,

To implement the search function, we use a search engine implemented in Javascript. For security reasons we filter the search query by removing special characters like $.

You can find more details about search engine in our user guide.
I would also like to know if its possible to enable the search for the special characters?
Unfortunately, there is no way to enable the search for the special characters.

Re: Help me understand webhelp responsive search

Posted: Wed Dec 18, 2019 4:37 pm
by revaljilji
For everyone wondering if we found the solution. We create a tag that would be used only for parameters in our .dita files. Then we included this tag into the scoring.properties as described here: https://www.oxygenxml.com/doc/versions/ ... ch-results and we set it to a really high number.

Then we needed to change the search.js file:
1. Add global variable, var specialCharacter = false;
2. Then in function searchAndDisplayResults (line 155), check if there are any of the special characters you use in the string, and if yes set the specialCharacter = true
3. In function computeHTMLResult, check if the specialVariable is set to true (before last else statement, where 'Search no results' localization is set). If so, append the desired message to $wh_search_results_items variable. We for example stated that the current search implementation doesn't support the special characters and instead "#USER_INPUT", they should search for "USER and INPUT". You can achieve this with a built in js function .replace.

Hopefully this helped.

Re: Help me understand webhelp responsive search

Posted: Thu Dec 19, 2019 4:27 pm
by ionela
Hi,

Thank you for your feedback.

I just wanted to mention that we do not recommend to modify the built-in files as this might to several problem when you update your oXygen XML/WebHelp installation.

Regards,
Ionela