Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Highlight - Settings #7264

Closed
GlennRicaud opened this issue Jul 29, 2019 · 1 comment
Closed

Highlight - Settings #7264

GlennRicaud opened this issue Jul 29, 2019 · 1 comment
Assignees

Comments

@GlennRicaud
Copy link
Contributor

GlennRicaud commented Jul 29, 2019

To be PRed in branch epic-highlight

Add capability to specify settings for the highlight
Settings can be set globally for all fields or by field (Then they override the global settings)

var result = repo.query({
        query: "displayName = 'Mine båter'",
        highlight: {
            "preTag" : "<a>",
            "fields": {
                "displayName": {
                    "preTag" : "<b>"
                }
            }
        }
    });

Add the following highlight settings

  • encoder
  • fragmenter
  • fragment_size
  • no_match_size
  • number_of_fragments
  • order
  • pre_tags
  • post_tags
  • require_field_match
  • tags_schema

Useful links:
Highlighting doc for current version: https://www.elastic.co/guide/en/elasticsearch/reference/2.4/search-request-highlighting.html
Listing of parameters for latest version of ES
https://www.elastic.co/guide/en/elasticsearch/reference/7.x/search-request-body.html#request-body-search-highlighting

@GlennRicaud
Copy link
Contributor Author

Little bug when unboxing parameters -> Fixed
Also noMatchSize should not have a default value I think -> Fixed
Fixed typo fragmenterSize to fragmentSize

Also there is a bug in ES: elastic/elasticsearch#9442
So "fragmentSize" works but only when selection the fragmenter "simple"

Below is the list of settings when using the JS lib
//Global
encoder
tagsSchema
//Global and field specific
fragmenter
fragmenterSize
noMatchSize
numberOfFragments
order
preTag
postTag
requireFieldMatch

Possible values:
encoder: 'default' (default) | 'html'
tagsSchema: 'styled' | null (default)
fragmenter: 'simple' | 'span' (default)
fragmentSize: integer (default:100) //See comment above
noMatchSize: integer (default:0)
numberOfFragments: integer (default:5)
order: "score" | "none" (default) //Did not manage to test this yet
preTag: string
postTag: string
requireFieldMatch: boolean (default: true)

GlennRicaud added a commit that referenced this issue Aug 1, 2019
GlennRicaud pushed a commit that referenced this issue Aug 1, 2019
GlennRicaud added a commit that referenced this issue Aug 1, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants