Search Options for NetHelp and Mobile Help

 

Doc-To-Help’s NetHelp and Mobile Targets  include powerful search features that you can customize for your needs, such as Server Side search.

      NetHelp 2.0 and Mobile Help

By default, JavaScript Client search is used in NetHelp 2.0 and Mobile Help Targets and requires no server setup. JavaScript Server search requires setup, but will improve the search speed of NetHelp 2.0 and Mobile Help Targets installed on a web server. See Setting up Server Side Search for NetHelp 2.0 and Mobile Help Targets.

      NetHelp Classic

By default, JavaScript Client search is used in NetHelp Classic Targets, but you also have the option of Java Server search. See NetHelp Classic Search Options.

 

JavaScript search supports exact phrase, Boolean, and fuzzy searches.

      Exact phrase search means that if you enclose a phrase in double quotes, the search will be limited to that exact phrase in the Help file, for example: “sports teams”.

      Boolean search means that you can use "AND" or "OR" (no quotes) between words or exact phrases when searching. You can also use "AND NOT" or "NOT" before a word or exact phrase to exclude topics containing that phrase from the results. By default, if there is no "AND" or "OR" between words, "AND" is assumed. For example: football or hockey, sports and not baseball. 

      Fuzzy search will display alternative search options (and results) if the user enters a search term that is close to the term entered. For example: sorts. Search will return “No topics found. Did you mean: sports.”

Setting up Server Side Search for NetHelp 2.0 and Mobile Help Targets

 

General information:

      The Search server is JavaScript-based and runs inside the Node.js server.

      The Search server uses HTTP protocol to handle search queries, so it requires a free port number on the server. For example, if the NetHelp 2.0 Target on the server is handled by a web server (IIS, Apache, etc.) and by default uses port 80, the search server will use 8256 by default. You must verify that the 8256 port for the search server is free and is not blocked by a firewall.

      The Search server can be used for either a single Target or for multiple Targets. Using a separate search server for each target can improve search  performance, while using the single search server for multiple targets makes the setup and support processes easier. If you run several search servers, each of them requires a separate port number.

 

Setting up the Search Type

1. Open the Help Targets dialog box (Home tab > click the dialog box launcher on the Target ribbon group).

2. In the Search Type field, choose JavaScript Server search.

3. Build the Target.

 

After the target is built, click the View button or view it when Doc-To-Help asks if you would like to view the Target. This will start the search server automatically and will open the NetHelp 2.0 or Mobile Help target in a browser where you can test the search server. (This starts the server locally and is only for testing.)

 

When you close the Target, the search server will be automatically shut down. When you build/rebuild this or another target and click on the View button again, the search server is restarted automatically.

Please note: You can test only one Target at a time. If you have two Doc-To-Help instances running and build a targets with the JavaScript Server search type, only one of them can be tested with the View button at a time. If you have one Target open already, and try to open another, you will receive an error message that says “you must shutdown the search server.” To do so, close the open Target and try again. A similar problem can occur if you run the server manually (as  described below) and haven't stopped it. In that case you will need to stop the search server manually (instructions below).

Setting up a server for a single target

 

Prerequisite: Node.js must be installed on the server. It can be downloaded here: http://nodejs.org

1. Copy your built target to the web server, for example, to "c:\d2h\targets\Pittsburgh250XMLSource".

2. Depending on the web server that you use (IIS, Apache, etc.), set up your server to serve the target files (for example, in IIS, set up a virtual directory). For example, http://localhost/d2h/Pittsburgh250XMLSource can point to "c:\d2h\targets\Pittsburgh250XMLSource".

3. Run the search server in node.js. For Windows:

      Open the command line (Start > All Programs > Accessories > Command Prompt).

      Verify that the current directory is "C:\", if it is not so, type "c:" and press Enter, this will change current directory to "C:\"

      Change the current directory and set it to the "js\nodejs" subfolder in the built Target folder, e.g., cd "c:\d2h\targets\Pittsburgh250XMLSource\js\nodejs", and press Enter

      Type "node index.js" and press Enter.

 

You should see the message "The server has started" in the command line window. You will also see log and error messages in this window when the search server is used.

 

To close the search server, you can press Ctrl+C in the command line window or just close it.

 

Viewing and testing server side search

1. Open the built Target in a browser (not from the local file system) i.e., the URL in the browser must start with the "http://" prefix, for example, http://localhost/d2h/Pittsburgh250XMLSource.

2. Try searching for a word.

Note: When you perform a search, you can see requests and responses from the server in the open command line window.

Setting up a single search server for multiple targets (for Windows)

1. Repeat steps 1-2 from Setting up a server for a single target for all targets.

2. Copy the search server files to a separate folder, for example, "c:\d2h\nodejs".

3. Go to the folder containing the search server files, "c:\d2h\nodejs" and open the "settings.json" file. This is a configuration file for the server, in JSON format. By default it has two settings:

      "port" is the port number that the search server will use. The default value is 8256. Make sure that this port isn't used by another application and isn't blocked by firewalls, otherwise you must change this value to any available port number.

      "host" is the IP address on which the search server will wait for requests. The default value is "null" and will work in most cases. You need to change this setting only if the system has several network interfaces and you want the search server to use a specific network interface.

4. To handle multiple targets by a single search server, you need to add the "targets" option to this file with information about your targets. After modifying the "settings.json" file, it could look like this:

{
    "port": 8256,
    "host": null,
          "targets": [
                   {
                             "path": "/d2h/Pittsburgh250XMLSource/",
                             "index": "c:\\d2h\\targets\\Pittsburgh250XMLSource\\searchindex.js"
                   },                
                   {
                             "path": "/d2h/Pittsburgh250WordSource/",
                             "index": "c:\\d2h\\targets\\Pittsburgh250WordSource\\searchindex.js"
                   }
          ]
}

Each target is described by two values:

      "path" is the virtual path you set up on the web server (IIS, Apache, etc.)

      "index" is a physical path to the search data of the target, the "searchinddex.js" file in the Target folder. Note that the character '\' must be expressed as '\\' in these strings.

5. Make sure you save all changes made to the "settings.json" file.

6. Repeat step 3 from Setting up a server for a single target to start the search server.

Note: The folder structure described in these steps is only an example; you can use any folder structure you wish.

Updating target configurations

If you change the port number setting in the server configuration, you must update this setting in Target(s).

1. Open the command line window and go to the folder containing the search server files, for example, "c:\d2h\nodejs" or "c:\d2h\targets\Pittsburgh250XMLSource\js\nodejs" (See step 3 of Setting up a server for a single target).

2. Execute "node searchserverconfig.js"; this will update port number in the configuration files in Target(s) folder.

The utility "searchserverconfig.js" uses the "settings.json" file to update target configurations.

 

NetHelp Classic Search Options

You can specify either a JavaScript Client or a Java Server search for NetHelp Classic. This option is set using the Search Type field in the Help Targets dialog box (Home tab > click the dialog box launcher on the Target ribbon group).

 

If your NetHelp Classic Target will be installed locally, JavaScript Client search is recommended to avoid dependence on Java being installed on end-user machines.

 

If your NetHelp Classic Target will be installed on a server, Java Server search is recommended for large projects. NetHelp Classic with Java Server search deployed on a server does not require that Java be installed on end-user machines, but Java does need to be installed on the server, along with a few other setup requirements. See NetHelp Classic Server Installation for instructions.