Adding a Text File Input Source

About this task

In contrast to a search collection input source, the text file input source is very basic. Text files for autocomplete dictionaries are expected to be configured so that each line contains an autocomplete phrase, followed by a space, and then a number representing the count. The count is optional, but it should be used to avoid unexpected results.

Note: The count is typically the number of times that a phrase occurs but can be seen as a weight if this text file is not derived from data with any sort of frequency, and is used to rank the phrases when they are returned as autocomplete suggestions.

Procedure

  1. Create a text file named autocomplete-tutorial.txt and save it to the velocity-install-dir/examples/data directory.
  2. Add the following information to the text file and save the changes:
    laura sidney 4
    sid halley 1
    dexter cranfield 1
    martin stukely 1
    bill davidson 1
    burt chekov 1
    julius filmer 1
    jockey club 1
    race horse 3
    bad guys 3
    electro-plastic mechanism 1
  3. Click the Add Input Source button.

    In the window that appears (as shown in Figure 1)

  4. Select File from the menu, and then
  5. Click the Add button.

    The input source has now been added to your autocomplete dictionary. Next, you must identify the text file to use.

  6. For the purposes of this tutorial, enter install-dir/examples/data/autocomplete-tutorial.txt into the Path to file field

    where install-dir is the path to your installation.

    Note: The path entered into the Path To File field must be a filesystem path on the server filesystem.

    When complete, your text file input source will look like Figure 1.

    Figure 1. Adding a Text File Input Source
  7. Click OK to complete the configuration of this input source.