Easy-Es Easy-Es
💋Home
  • v2.0.0(current version)
  • What's New

    • What' s New In Easy-Es v2.0.0?
  • history version

    • v1.x.x
  • Upgrade guide

    • Upgrade to 2.x.x instructions
💖Support
  • OS Community
  • Recommend Goods
  • Project PPT (opens new window)
  • Project introduction
  • Project members
  • PR
Join
Customer
  • Doc-Apis (opens new window)
  • Fitness plan automatic generation system (opens new window)
  • Vuepress-theme-vdoing (opens new window)
  • Gitee (opens new window)
  • Github (opens new window)
  • 简体中文 (opens new window)
  • English (opens new window)

adv display by random ❤️become sponsor
💋Home
  • v2.0.0(current version)
  • What's New

    • What' s New In Easy-Es v2.0.0?
  • history version

    • v1.x.x
  • Upgrade guide

    • Upgrade to 2.x.x instructions
💖Support
  • OS Community
  • Recommend Goods
  • Project PPT (opens new window)
  • Project introduction
  • Project members
  • PR
Join
Customer
  • Doc-Apis (opens new window)
  • Fitness plan automatic generation system (opens new window)
  • Vuepress-theme-vdoing (opens new window)
  • Gitee (opens new window)
  • Github (opens new window)
  • 简体中文 (opens new window)
  • English (opens new window)
  • Quick start

    • Introduction.md
    • Applicable scene
    • Worry free
    • Avoid pit
    • Quick start
    • Springboot demo
    • Spring Integration Guide
    • Solon Integration Guide
    • Config
    • Annotation
  • Core function

    • Condition constructor

      • Introduction of Wrapper
      • Index wrapper
      • Select wrapper
      • Update wrapper
    • Index CRUD

      • Index hosting model
      • Index CRUD
    • Data CRUD

      • Data synchronization solutions
      • Data CRUD
    • Multiple data sources support
    • Dynamic indexing support
    • Four nested query
    • Chain call
  • Extended function

    • Mixed query
    • Origin query
    • Page
    • Nested
    • Join parent child
    • Get DSL
    • ExecuteDSL
    • Execute SQL
    • Custom RequestOptions
    • Custom default method
  • High-level syntax

    • Field filtering
    • Sort
    • Aggregation
    • Match&fuzzy match
    • Weight
    • Highlight
      • @HighLight
      • annotation usage examples
    • Geo
    • IP
  • Plugin

    • Plugin
  • Other

    • Faq
    • Difference from MP
    • MySQL and EE syntax comparison
    • Update log
    • Update plan
    • Copyright
    • Thanks
  • v2.xDoc
  • High-level syntax
LaoHan
2023-03-18
目录

Highlight

提示

Highlighting fields can be achieved with the custom annotation @HighLight, which can be added to the fields that need to be highlighted

# @HighLight (opens new window)

-Description: Highlight the note -Usage location: the queried field that needs to be highlighted in the entity class. -Use scenarios as examples: for example, enter the keyword "old man" to query, and expect the part containing "old man" in the content to be displayed in red or bold.

Attribute Type You must specify Default Description
mappingField String No "" Highlight the name of the content mapping field. For example, if I want to assign the highlighted content" Old Man "to the field pushCar, I can specify this attribute value as pushCar
fragmentSize int No 100 Intercept length of highlighted field, the default is 100
numberOfFragments int No -1 The number of highlighted fragments returned by search, and all are returned by default
preTag String No < em > Highlight the tag, and the highlighted content will be behind preTag
postTag String No < /em > Highlight the tag, and the highlighted content will come before the postTag
highlighttype highlighttypeenum No UNIFIED Highlight type
requireFieldMatch boolean no true Whether the highlighted content needs to match the query field. The default value is true. When it is no, non-query fields in the hit content will also be highlighted if they contain highlighted content

# annotation usage examples

public class Document{
    /**
     * Fields that need to be highlighted
     */
    @HighLight
    private String content;
    // Omit other irrelevant fields...
}
1
2
3
4
5
6
7
8

提示

If you don't want the original field value to be overwritten by the highlighted field, then you need to specify the mappingField in the @HighLight annotation and add the field to the corresponding entity class, so that after the configuration, the highlighted content is returned in the highlightedContent field, and the value of the original content field still returns its own value.

For example:

public class Document{
    /**
     * Fields that need to be highlighted
     */
    @HighLight(mappingField = "highlightContent")
    private String content;
    /**
     * The field whose return value is mapped to be highlighted
     */
    private String highlightContent;
    // Omit other irrelevant fields...
}
1
2
3
4
5
6
7
8
9
10
11
12

Other

  • highlight annotation supports setting the length of the highlighted content interception fragmentSize, the default value is 100
  • The highlight annotation supports setting the label of the highlighted content, the default is the label em
Help us improve this document (opens new window)
Last update: 2024/04/12
Weight
Geo

← Weight Geo→

Theme by Vdoing | Copyright © 2021-2025 LaoHan | Zhejiang ICP No. 2022020479 | MIT License
  • 跟随系统
  • 浅色模式
  • 深色模式
  • 阅读模式