Synonym Dictionary Management

Here, we explain the 'Synonym Dictionary,' where you can register and deploy synonym dictionaries.

Page Sections

Synonym Dictionary and KandaSearch

By using a synonym dictionary, for example, when you search with the keyword 'スマホ' (smartphone), documents containing 'スマートフォン' (smartphone) will also be displayed in the search results, improving the recall rate (reducing search omissions).
In Apache Solr, synonym searches are possible using SynonymGraphFilter or ManagedSynonymGraphFilter. To use this feature, you need to define and deploy the dictionary in CSV or JSON file format.
Using the synonym dictionary feature in KandaSearch makes it easy to manage and deploy synonym dictionaries.

To use the synonym dictionary

In KandaSearch, you can deploy the synonym dictionaries added to a project to collections within the same project's instances.
To display the synonym dictionary screen for managing and deploying these dictionaries, follow the steps below:

  1. Log in to KandaSearch.
  2. From the project list screen, click on the name of the target project. (To display the project list, click on the KandaSearch logo at the top left of the screen.)
  3. In the project view, click 'Synonym Dict.' from the left side menu.
  4. The list screen of registered synonym dictionaries will be displayed.

Synonym Dictionary List

When you click 'Synonym Dict.' from the left side menu in the project view, a list of added synonym dictionaries will be displayed.
This screen includes the following features:

  • 'ADD A DICTIONARY' button
    • You can add a dictionary (details provided later).
  • Dictionary information display
    • The dictionary name and creator of the respective row are displayed.
  • 'View Dictionary' (book) icon
    • Moves to the detailed view of the respective dictionary.
  • 'Rename Dictionary' (rename) icon
    • Allows you to rename the dictionary in the respective row (details provided later).
  • 'Deploy Dictionary' (cloud) icon
    • Allows you to deploy the dictionary in the respective row (details provided later).
  • 'More Actions' (vertical ellipsis) icon - 'Import words to dictionary'
    • Allows you to import words into the respective dictionary (details provided later).
  • 'More Actions' (vertical ellipsis) icon - 'Export dictionary as...'
    • Allows you to export the respective dictionary (details provided later).
  • 'More Actions' (vertical ellipsis) icon - 'Delete dictionary'
    • Allows you to delete the respective dictionary (details provided later)."

Add a Synonym Dictionary

When you click 'ADD A DICTIONARY' on the synonym dictionary list screen, you can add a dictionary.
Here's how to add a synonym dictionary:

If you only want to create a new dictionary

  1. Click on 'ADD A DICTIONARY' at the top right of the synonym dictionary list screen.
  2. When creating a new dictionary only, click on the 'NEW' tab (by default, the 'NEW' tab is selected), enter the dictionary name (Japanese can also be specified for the dictionary name).
  3. Click on 'CREATE'.
  4. Confirm that the dictionary has been added on the synonym list screen.

If you want to import and add a dictionary file from your local PC

  1. Click on 'ADD A DICTIONARY' at the top right of the synonym dictionary list screen.
  2. If you want to import and add a dictionary file from your local PC, click on the 'IMPORT' tab.
  3. Drag and drop the dictionary file from your local PC into the dashed box, or click on 'CHOOSE A FILE' within the dashed box and specify the dictionary file.
  4. Enter the dictionary name (Japanese can also be specified for the dictionary name).
  5. Click on 'CREATE'.
  6. Confirm that the dictionary has been added on the synonym list screen.

Notes.

  • There is a limit (500KB) to the file size that can be uploaded.
  • The character encoding of the file is UTF-8.

Dictionary Details - List

When you click on the 'View Dictionary' (book-shaped) icon on the synonym dictionary list screen, the detailed view of that dictionary is displayed.
This screen includes the following features:

  • Search box and Search button
    • You can search for words within the dictionary. Exact match search is also possible.
  • 'ADD A SYNONYM SET' button
    • You can add a synonym set. (Details provided later)
  • 'Settings' (gear) icon - 'Rename dictionary'
    • You can rename the dictionary. (Details provided later)
  • 'Settings' (gear) icon - 'Deploy dictionary'
    • You can deploy the dictionary. (Details provided later)
  • 'Settings' (gear) icon - 'Import words to dictionary'
    • You can import words into the dictionary. (Details provided later)
  • 'Settings' (gear) icon - 'Export dictionary as...'
    • You can export the dictionary. (Details provided later)
  • 'Settings' (gear) icon - 'Delete dictionary'
    • You can delete the dictionary. (Details provided later)
  • Information display for synonym sets
    • Whether the comment is present or not for the synonym set in the respective row (hover over the icon to see the comment), content, editors, and last updated date and time are displayed.
  • 'Edit' (pencil) icon
    • You can edit the synonym set in the respective row. (Details provided later)
  • 'Delete' (trash can) icon
    • You can delete the synonym set in the respective row. (Details provided later)

Dictionary Details - Adding Synonym Set

Here's how to add a synonym set from the dictionary details screen:

  1. Click on 'ADD A SYNONYM SET' at the top right of the dictionary details screen.
  2. The 'Create A Synonym Set' dialog box will appear. Enter a comment (optional).
  3. Enter words into the 'New Word' field and click on the + icon. Repeat this as needed.
  4. Click 'CONFIRM'.
  5. Confirm that the synonym set has been added on the dictionary details screen.

Notes.

  • Clicking 'RESET' will clear all entered information.
  • Added words can be deleted by clicking the delete (trash can) icon at the right end of their respective rows.
  • Added words can be reordered by dragging and dropping the delete handle (= shape) icon at the left end of their respective rows.

Dictionary Details - Editing Synonym Sets

Here's how to edit a synonym set from the dictionary details screen:

  1. Click on the 'Edit' (pencil) icon of the synonym set row displayed on the dictionary details screen.
  2. The 'Update Synonym Set' dialog box will appear. Make your edits.
  3. Word editing is not possible, so after deletion, add them as new words.
  4. Click 'CONFIRM'.

Notes.

  • Clicking 'DISCARD' will revert all edited information back to its original state.
  • You can delete a word by clicking the delete icon at the right end of the word row.
  • You can change the order of words by dragging and dropping the delete handle (shaped like =) icon at the left end of the word row.
  • Rows with 'Unsaved' displayed next to the added words have not been saved. Click 'CONFIRM' to save them.

Dictionary Details - Deleting Synonym Sets

Here's how to delete a synonym set from the dictionary details screen:

  1. From the list on the dictionary details screen, click on the "Delete" (trash can) icon of the set you want to delete.
  2. A confirmation dialog box titled 'Delete Synonym Set Confirmation' will appear. Click 'CONFIRM'.

Please note that deleted synonym sets cannot be restored.

Rename Dictionary

Here's how to rename a dictionary:

  1. Click on 'Synonym Dict.' from the left side menu in the project view to display the list of synonym dictionaries.
  2. Click on the 'Rename Dictionary' (rename) icon of the dictionary you want to rename in the list of dictionaries to be rename. Alternatively, select 'Rename dictionary' from the 'Settings' (gear) icon on the dictionary details screen.
  3. The 'New Dictionary name' dialog box will appear. After editing the dictionary name, click 'UPDATE'.

Deploy Dictionary

To utilize the synonym dictionary, it's necessary to deploy and reload it to the collection created in the search engine instance. This functionality facilitates easy deployment and reloading.
Please note that you need to have configured the settings in the managed-schema of the target collection to perform searches using the synonym dictionary. Afterwards, specify the parameters accordingly and deploy.
After making changes to the dictionary, remember to deploy it using this feature.

Here's how to deploy a synonym dictionary:

  1. Click on 'Synonym Dict.' from the left side menu in the project view to display the list of synonym dictionaries.
  2. Click on the 'Deploy Dictionary' (cloud) icon of the dictionary you want to deploy in the list of dictionaries to be deployed. Alternatively, select 'Deploy dictionary' from the 'Settings' (gear) icon on the dictionary details screen.
  3. The 'Deploy Dictionary' dialog box will appear. Specify each item and click 'CONFIRM'.
  4. Verify if searches using the synonym dictionary can be performed from the search UI, etc.

Notes.

  • You can disable reloading by turning off the 'Reload collection after deploy' checkbox after deployment is complete.

Setting examples:

  • Instance: The name of the instance where the collection is added.
  • Collection: The name of the collection.
  • Synonym Filter: ManagedSynonymGraphFilter
  • Managed Resource: synonym-ja
  • Parameters:
    • tokenizerFactory: solr.JapaneseTokenizerFactory
    • tokenizerFactory.mode: normal
    • ignoreCase: true
    • format: solr

Example of managed-schema settings at query time

  <fieldType name="text_ja" class="solr.TextField" autoGeneratePhraseQueries="true" positionIncrementGap="100">
    <analyzer type="index">
    ...
    </analyzer>
    <analyzer type="query">
      <tokenizer name="japanese" mode="normal" userDictionary="userdict_ja.txt"/>
    ...
      <filter name="managedSynonymGraph" managed="synonym-ja"/>
    ...
    </analyzer>
  </fieldType>

Importing Words into the Synonym Dictionary"

You can import words registered in a dictionary file on your local PC into an existing dictionary.
Here's how to import:

  1. Click on 'Synonym Dict.' from the left-side menu in the project view to display the list of synonym dictionaries.
  2. Select 'More Actions' (vertical ellipsis) icon of the target row - 'Import words to dictionary'. Alternatively, choose 'Settings' (gear) icon on the dictionary detail page and select 'Import words to dictionary'.
  3. A dialog box 'Import Words To your_dictionary_name' will appear. Drag and drop the dictionary file from your local PC into the dashed box, or click on CHOOSE A FILE' within the dashed box and specify the dictionary file.
  4. Click on 'CONFIRM'.
  5. On the dictionary list page, click on the 'View Dictionary' (book) icon of the target row to confirm whether the words have been imported.

Notes.

  • Only the 'Clear existing data before import' function is supported (the checkbox cannot be turned off). Any words previously registered in the dictionary will be deleted, and the contents of the specified file will be overwritten.
  • There is a limit to the file size that can be uploaded (500KB).
  • The file encoding must be UTF-8.

Exporting the Dictionary

You can export the added dictionary as follows:

  1. Click on 'Synonym Dict.' from the left-side menu in the project view to display the list of synonym dictionaries.
  2. Select 'Export dictionary as...' from the "More Actions" (vertical ellipsis) icon for the dictionary you want to export. Alternatively, select 'Export dictionary as...' from the 'Settings' (gear) icon in the dictionary detail view.
  3. In the 'Export Dictionary As...' dialog box, specify the file format and whether to simultaneously output comments (only when specifying CSV file format).
  4. Click'DOWNLOAD'.
  5. Verify the contents of the downloaded file on your local PC.

Deleting Dictionary

Here are the steps to delete a synonym dictionary:

  1. Click on 'Synonym Dict.' from the left-side menu in the project view to display the list of synonym dictionaries.
  2. Select 'Delete Dictionary' from the 'More Actions' (vertical ellipsis) icon for the dictionary you want to delete. Alternatively, select 'Delete Dictionary' from the "Settings" (gear) icon in the dictionary details page.
  3. A confirmation dialog box for deleting the dictionary will appear. Click 'CONFIRM'.'
  4. Verify that the dictionary has been deleted on the synonym list page.

Please note that deleted synonym dictionaries cannot be restored, so proceed with caution.