How do I add synonyms to be used when searching for answers?
Oracle Service Cloud
Depending on which version of Oracle Service Cloud you are using, there are several options for including synonyms and additional search terms when you search for answers.
- Keywords and phrases can be added individually to specific answers.
- The aliases.txt file allows you to define specific sets of keywords to be used across all answers in your knowledgebase. The aliases.txt file is used with all types of searching (such as Phrases and Exact Phrases). The aliases.txt file is helpful for defining business-specific synonyms and acronyms used throughout your answer content and across the entire knowledge base.
- The thesaurus.txt file is a comprehensive synonym list that is used when using the Similar Phrases option when searching. The thesaurus.txt file is not used with other search types such as Phrases or Exact Phrases.
Adding Keywords to an Individual Answer
When you edit and save an answer, you can include specific keywords directly to the answer in the Keywords field. This allows you to define specific synonyms for individual answers in your site.
That is, if users search for a specific phrase or acronym, you might only want a couple of answers returned in the search. In that case, you could add the search word or phrase to the Keywords field and those answers will be returned (along with any answers that have that term in the actual Summary, Question, or Answer field).
When adding multiple words or phrases, it is important to separate the words and phrases using a comma so that they are indexed correctly in the database.
This allows you to more tightly control which keywords are used with specific answers. For more information on adding keywords to individual answer, refer to Answer ID 1301: Keywords field when editing answers.
Defining Aliases for All Answers and Search Types
The aliases.txt file allows you to define an overall group of synonyms that are be used for searching answers from either the end-user Answers page or the administrative pages. The aliases.txt file allows you to define a global or "master" list of keywords to be used when searching for answers. Typically, this file is used for business-specific terminology and acronyms that you define.
Frequently, when people begin populating keywords for their answers, they determine that the same group of keywords should be added to several answers and used throughout the entire set of published answers.
The aliases.txt file allows you to define sets of keywords and synonyms that are used across all answers with every answer search that is performed, regardless of whether the search type is Phrases, Similar Phrases, Exact Search or Complex Expression. For more information on using the aliases.txt file, refer to Answer ID 1995: Using a list of common aliases and keywords for all answers.
To access the aliases.txt file, go to the File Manager. Then, set the Switch to menu to be "wordlist files".
Similar Phrases Synonyms
The default configuration of the end-user pages allows users to search using the Similar Phrases option from the Search By menu. This search option returns answers that include synonyms for the search phrase as defined by the synonym relationships listed in the thesaurus.txt file. The thesaurus.txt file defines the synonyms to be used and included when using the Similar Phrases search type.
The contents of the thesaurus.txt file is quite exhaustive and includes synonyms for general words used in everyday language, not just synonyms for technical terms or business-specific terms and acronyms used in your industry. As a result, when users search using the Similar Phrases option, they will typically get a large number of answers back as their search results.
Due to the large amount of synonyms defined and the large query results from the database, this type of searching may take longer to perform than other searching methods. For this reason, the synonym list is NOT used for standard phrase searching, exact phrase searching or with complex expressions.
To access the thesaurus.txt file, go to the File Manager. Then, set the Switch to menu to be "wordlist files".
Editing the aliases.txt and thesaurus.txt Files
Defining synonym relationships in the aliases.txt and thesaurus.txt is similar. For both the aliases.txt and thesaurus.txt files, each line in the file is set up to mean:
IF the first word in the line is used as the search word, THEN return answers containing that word or any of the other words on that line.
That is, the first word on each line of the file is the search word and the additional words are the synonyms that exist in your answers that will be searched for. Therefore, when someone searches on the first word, answers that include the remaining words are returned in the search.
When adding words to the list: Multi-word phrases are supported within the aliases.txt file, but not within the thesaurus.txt file. Note: if using multi-word phrases within the aliases.txt file and ANS_AND_SEARCH is enabled, phrases are expanded before aliases are processed.
Assume the aliases.txt file contains (note the space within RIGHT NOW): RIGHT NOW,RNT
Assume an answer contains "RNT".
Search for "RIGHT NOW"
If ANS_AND_SEARCH is enabled, a search for "RIGHT NOW" will not return the RNT answer since a Boolean AND search tries to match all single word phrases. In this case, it would try to match both "RIGHT" and "NOW". Since "RIGHT" and "NOW" do not have aliases, the search will not match the RNT answer even though the "RIGHT NOW" phrases will expand to include "RNT".
Hyphens are acceptable (END-USER). Also, all entries must be in CAPITAL LETTERS. If listing several synonyms for a word, use a comma delimiter with NO SPACE between the synonyms. Other entries in a line can contain a space, it is only the first term in the line that cannot include a space.
For example, let's say that you added the following line in the thesaurus.txt or aliases.txt file:
If an end user searches your answers using the word aardvark, answers that include the words aardvark, antbear, or anteater are returned.
If the user instead searches on antbear, the answers containing the word aardvark are only returned if there is another line in the file that has antbear listed first on the line:
Then, to complete all searching opportunities for this example, a third line should be included in the synlist.txt file that has anteater first:
Note: When working with the aliases.txt and thesaurus.txt files, if you know that your answers include specific words and terminology, it may not be necessary to include a line for all combinations of synonyms or it may not be necessary to include all other entries from another line.
For example, if you know that your answers only use the word aardvark and that the words antbear and anteater are not used in your answers, you can simplify your entries to be:
When you save the aliases or thesaurus file, the wltool utility should automatically run so that changes to the file take immediate effect on the search functionality of your end-user pages.