SearchHighlighting

Prev Next

Available in Classic

This is the search result syntax highlight settings information.

Syntax

The syntax is as follows.

private String enable;
private String pre_tag;
private String post_tag;
private Object option;

Field

The following describes the fields.

Field Type Required Description
enable String, Boolean Optional Set whether to highlight
  • true (default) | false
pre_tag String Optional Start tag of matched syntax
  • HTML tag format
  • <b> (default)
post_tag String Optional End tag of matched syntax
  • HTML tag format
  • <b> (default)
option Object Optional Object as a map that specifies syntax highlight settings
  • key: syntax highlight options
    • <Example> Remove duplicates: "remove_duplicate"
  • value: Whether the option is used
    • true | false
  • key option types
    • remove_html_tag: Remove HTML tags when this option is enabled
    • skip_html_tag: When this option is enabled, it highlights HTML tags or leaves the characters contained in the tag intact without transforming them
    • braket_as_tag: When this option is enabled, everything between < and > is considered an HTML tag
    • num_entity_as_char: When this option is enabled, numeric entities, such as values, are treated like characters. Highlighting is also done by treating the entity as a character
    • skip_char_entity: When this option is enabled, keep character-type entities intact without highlighting or transforming the characters they contain
    • kata_to_hira: When this option is enabled, Japanese katakana and hiragana characters that correspond to each other are treated as the same character
    • bold_sub_query: When this option is enabled, all partial keywords are highlighted, even if an exact match to the query is found
    • bold_sub_english: When this option is enabled, it highlights even if part of the English word matches the keyword. E.g., Highlight the first letter "a" in "about" when the keyword is "a"
    • bold_sub_digit: When this option is enabled, highlight even if part of a number matches the keyword. E.g., Highlight the first digit "1" in "12345" when the keyword is "1"
    • bold_sub_hanja: When this option is enabled, do not restrict Chinese character highlighting

Examples

The following is a sample search request.

{
  "search": {
    "product": {
      "main": {
        "query": "keyboard"
      }
    }
  },
  "highlighting": {
    "enable": true,
    "pre_tag": "<b>",
    "post_tag": "</b>",
    "remove_html_tag": true,
    "skip_char_entity": true,
    "kata_to_hira": false,
    "bold_sub_query": false,
    "bold_sub_english": true,
    "bold_sub_digit": true,
    "bold_sub_hanja": false
  }
}