Page 1 of 1

Customizing search results using keywords

Posted: Tue Mar 10, 2015 4:51 pm
by caval
We've noticed that the threshold for the search indexing seems to be 3 chars or greater.

So the 3GPP S6a interface is indexed and shows up in the search results, but the S9 interface does not appear.

Based on other posts suggesting that adding metadata keywords is a way to prioritize search results, we tried adding metadata keyword for S9 but this does not resolve the problem.

Is there a way to force the index function to recognize a term such as S9 or, alternatively, to insert custom search terms in the indexing function?

(This problem relates to Oxygen 16.1 webhelp).

Re: Customizing search results using keywords

Posted: Tue Mar 10, 2015 4:56 pm
by caval
I noticed in your documentation that you do point out this limitation of 3 or more characters. Fair enough. I'm still wondering if there is a way to force indexing of certain keywords that are only 2 chars.

Re: Customizing search results using keywords

Posted: Tue Mar 10, 2015 5:26 pm
by sorin_ristache
Sorry, in the current version (16.1) the threshold is 3 characters and it can't be forced down or circumvented with custom search terms. However starting with the next version (17.0) the threshold will be lowered to 2 characters for non-Asian languages and 1 character for Asian languages.

The initial threshold of minimum 3 characters was imposed to filter out common words like to, or, an, is, etc. that would not increase the search accuracy anyway if they were allowed. But cases like your S9 search term prompted us to lower the threshold.

Re: Customizing search results using keywords

Posted: Mon May 11, 2015 8:43 pm
by caval
Greetings,

Was this update enabling search for strings of 2 characters (such as Gx, Gy, Sy, etc.) included in the recent v17 of the webhelp?

Re: Customizing search results using keywords

Posted: Wed May 13, 2015 12:17 pm
by Radu
Hi,

Sorry for the delay.
I think we had a previous email conversation, I will also try to update this thread with my suggestions:

The good news seems to be that the indexer which builds the index tables has been modified to also index words composed of two letters.
So the only issue would be to make some small Javascript changes.

If you have the time, please open the Javascript file:
OXYGEN_INSTALL_DIR/frameworks/dita/DITA-OT/plugins/com.oxygenxml.webhelp/oxygen-webhelp/search/nwSearchFnt.js

find the function called:

Code: Select all

function contains(arrayOfWords, word)
which has an if clause like:

Code: Select all

if (word.length > 2 || indexerLanguage == "ja") {
You can let the code inside the if clause execute all the time, so just comment out the if statement like:

Code: Select all


     //if (word.length > 2 || indexerLanguage == "ja") {
found = false;
for (var w in arrayOfWords) {
if (arrayOfWords[w] === word) {
found = true;
break;
}
}
//}
Also at the beginning of the function called:

Code: Select all


 function realSearch(expressionInput)
add this line:

Code: Select all


 expressionInput = expressionInput.trim();
like:

Code: Select all


 function realSearch(expressionInput) {
expressionInput = expressionInput.trim();
............
And one more thing to do, search in the same Javasacript file for:

Code: Select all

...finalArray[x].length > 2....
and replace it with a greater than:

Code: Select all

...finalArray[x].length >= 2....
Then publish to WebHelp and try to see if this works for you.

Regards,
Radu

Re: Customizing search results using keywords

Posted: Thu May 14, 2015 4:50 pm
by caval
Thanks Radu. This solution works well in our tests.