Customizing search results using keywords

Having trouble installing <oXygen/>? Got a bug to report? Post it all here.
caval
Posts: 25
Joined: Tue Jan 27, 2015 9:05 pm

Customizing search results using keywords

Post by caval » Tue Mar 10, 2015 4:51 pm

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).

caval
Posts: 25
Joined: Tue Jan 27, 2015 9:05 pm

Re: Customizing search results using keywords

Post by caval » Tue Mar 10, 2015 4:56 pm

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.

sorin_ristache
Posts: 4144
Joined: Fri Mar 28, 2003 2:12 pm

Re: Customizing search results using keywords

Post by sorin_ristache » Tue Mar 10, 2015 5:26 pm

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.
Regards,
Sorin

<oXygen/> XML Editor Support

caval
Posts: 25
Joined: Tue Jan 27, 2015 9:05 pm

Re: Customizing search results using keywords

Post by caval » Mon May 11, 2015 8:43 pm

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?

Radu
Posts: 6403
Joined: Fri Jul 09, 2004 5:18 pm

Re: Customizing search results using keywords

Post by Radu » Wed May 13, 2015 12:17 pm

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
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com

caval
Posts: 25
Joined: Tue Jan 27, 2015 9:05 pm

Re: Customizing search results using keywords

Post by caval » Thu May 14, 2015 4:50 pm

Thanks Radu. This solution works well in our tests.

Post Reply