Improving WebHelp search results in RoboHelp

The full-text search in RoboHelp is an incredibly useful feature. However, scrolling through a list of alphabetized results can be daunting when you are looking for only the most relevant topic to your search keywords.

MadCap has solved this problem by adding a ranking system to the search results in Flare's browser-based help output. I imagine it won't be long before the RoboHelp team does the same.

In the meantime, what if you could alter how topic titles are presented in the WebHelp results pane, so that the best options are easier to find?

With a bit of work, you can.

RoboHelp uses a function called displayTopics in whfhost.js to display WebHelp search results. By adding a bit of JavaScript to this function after you generate your help, you can change how the search results appear.

For example...

In this example, the search sorts out any topics where the search keyword is part of the topic title. These are added to the Recommended section. As you can see, in most cases it will be much easier to find the desired topic quickly.

This modified version uses a JavaScript regular expression.

var rg = new RegExp(gsCW,"ig");

Results are compared to this expression and sorted appropriately before they are displayed.

This particular example assumes that topic titles are well chosen so that those appearing in the recommended list are the most relevant. However, it might not be suitable for projects that have more than several hundred topics. In such cases, even the Recommended list would require scrolling, and users might miss the second list that follows.

The point is, with a bit of scripting skill, you can modify the whfhost.js file and customize the search results. Just make sure your changes will actually benefit users. Also, take time to familiarize yourself with the code before making changes. (Don't worry, this file gets regenerated whenever you compile your help.)

If you need to brush up on your JavaScript skills, try W3Schools tutorials. They have an incredible archive of tutorials that are friendly to non-programmers, and definitely top the list of my favorite resources.

Are you happy with the search functionality just the way it is? No problem. At least you now know the purpose of whfhost.js.

To implement this technique in your own WebHelp system, open the whfhost.js file in your /!SSL!/WebHelp folder, and replace function displayTopics(){ } with the code below. Enjoy!


function displayTopics()
{

    var recHTML="";
    var sHTML="";
    var sLine="";


    var foundRecTopics = 0;
    var foundAnyTopics = 0;

    var rg = new RegExp(gsCW,"ig");

    var recHead="<dt><nobr><b>Recommended topics</b></nobr></dt>";
    var allHead="<br><dt><nobr><b>Other topics</b></nobr></dt>";


    for(var i=0;i<gaTI.length;i++){
        if(gaTI[i].sTopicTitle.search(rg)>-1){
            recHTML+="<dt><nobr><a href='"+gaTI[i].sTopicURL+"'>"+_textToHtml(gaTI[i].sTopicTitle)+"</a></nobr></dt>";
            foundRecTopics = 1;
        }
        else{
            foundAnyTopics=1;
            sLine+="<dt><nobr><a href='"+gaTI[i].sTopicURL+"'>"+_textToHtml(gaTI[i].sTopicTitle)+"</a></nobr></dt>";
            if(i>>4<<4==i){

                sHTML+=sLine;
                sLine="";
            }
        }
    }
    if(sLine.length>0)
        sHTML+=sLine;


    if (!foundRecTopics) {
        recHTML+="<dt><nobr>No topics found.</nobr></dt>";
    }

    if(!foundAnyTopics)
        sHTML+="<dt><nobr>No topics found.</nobr></dt>";
   
    sHTML="<dl>"+recHead+recHTML+allHead+sHTML+"</dl>";

    var resultDiv=getElement(gsResultDivID);
    if(resultDiv)
        resultDiv.innerHTML=sHTML;
}

Related posts:

8 tips for writing informative overview topics

Overview topics play an important role in creating a positive user assistance experience. Unlike procedures, which deliver critical information on how to solve a problem quickly, overview topics fill in the conceptual details and background "story."

Here are some tips for writing thorough and informative overviews.

  • Stay focused. The goal of the overview topic is to provide a broad picture of a single concept. For example, "Overview of printing." Such a topic might provide information on when the print functionality is available, what role printing plays in the overall use of the software, and so on. It should NOT cover information on a different concept, such as editing documents.
  • Include a generous helping of hyperlinks. Overview topics should provide only the big picture, but they should link to all of the details. Your "Overview of printing" should include links to "Printer setup," "Changing print options," and other related procedures. You should also link to FAQs, troubleshooting tips, and any other granular topics related to printing.
  • Include plenty of subheadings. Usability studies show that readers, on average, only look at roughly 30 percent of the content on a page. The use of subheadings allows them to skim effectively to find the information they need.
  • Consider internal navigation. Long topics may benefit from a table of contents or some mid-topic anchors to allow users to navigate within the page. A long overview can make for tedious scrolling, so linking within the same page can make for a more pleasant user experience.
  • Keep paragraphs short. Research shows that readers prefer shorter paragraphs when reading digital content. A few sentences per paragraph is optimal, so you may need to break longer paragraphs into several short paragraphs.
  • Follow Strunk and White's advice and "Omit unnecessary words." Carefully consider whether your content can convey the same important information in less words. Remember, users access the help when they are frustrated. Don't make them read the equivalent of "War and Peace" to understand the role of printing in your software. If a sentence doesn't contain need-to-know information, strike it.
  • Use the word "overview" in your topic title. Users should be able to skim the titles in your table of contents, index, and full-text search results and quickly identify whether a topic contains overview information.
  • Create an outline before you start writing. This will ensure that your resulting topic is thorough and covers all facets of the concept. If you can, have a fellow writer or an SME perform a peer review of the outline to verify that you haven't missed anything.

If you follow these guidelines, your overview topics will be informative and highly usable.

Related topics:

Why software is the best technical writing field

Do any of you remember your first computer? Can you recall the feelings it evoked? (Really, think back.) Those feelings have everything to do with why I believe the best technical writing fields involve software.

Command lines and wide-eyed wonder

My first computer came one snowy Christmas morning circa 1984. I was in elementary school.

My parents had set the machine up, and I stood there in my pajamas in awe as the blue glow of the monitor (an old color TV) enchanted me. That 20k RAM machine had so much potential, and promised worlds of experimentation that were like candy to my insatiable elementary-school curiosity.

Software was different then. (Everything was different.)

There were no CD-ROMs. The best software came on cartridges. Much of it came in the form of BASIC or machine-language code in the backs of magazines. I spent many late hours typing in such code and saving it onto blank audio cassettes.

Bent bindings and dog-eared pages

Around the same time I acquired my first Cub Scout Handbook. The Cub Scout motto was "Be prepared." That book was incredible; it had procedures on how to tie square knots, use a compass, shoot a bow and arrow, identify animal tracks, and build a campfire. In short, everything a bright-eyed boy needed to pursue life's adventures.

And so I devided my time between mastering the VIC-20 operating system and learning how to craft a longbow from a sapling and some kite string. By the time the next Christmas arrived, both my Commodore user manual and the scout handook were coming apart at the bindings. Those two manuals held fascinating secrets that opened up new worlds to me.

Those manuals are the reason I'm so enthralled with writing instruction manuals as an adult. Each time I sit in front of a computer or crack the spine of a manual, those childhood feelings of excitement come flooding back.

Practical reasons to join the ranks

In addition to nostalgia, there are many reasons I believe the software industry to be one of the best technical writing fields. Here are some of those reasons:

  • Future growth. The software industry is growing fast, and as new applications emerge, more documentation will be required.
  • Great pay. Software can turn a nice profit. Many software companies view technical writers as part of product development, and pay them great wages.
  • Constant change. Software technology changes rapidly. While this requires writers to learn quickly, it also provides excitement and opportunity.
  • Excellent atmosphere. Most software writers work in air- conditioned office buildings with cafeterias and coffee machines.
  • Great tools. Software development requires high-end computers and cutting-edge software.
  • Positive team spirit. In spite of tight deadlines, software development is way less stressful than many other fields. This leads to happier workers and an overall sense of positivity from everyone.
  • Flexible environment. Software writing can be done from a remote machine or home office, and allows for flexible schedules.
  • Career options. The diverse set of skills held by software writers allows them to move into many other positions within the field. Some leverage technical skills to move into programming or software engineering. Others use their communication skills to become product managers, trainers, or support reps.

The software industry is filled with many interesting challenges for technical writers to solve. With each document we write, we make the world of computers less mysterious for our users. We help them embrace technology instead of fearing it.

We are diplomats, brining people and computers together.

And we get to play with some really fun software.

More posts like this one: