jillesvangurp/kt-search

[FEAT] Implement highlighting

Closed this issue · 2 comments

Describe the enhancement

Add support for highlighting

Why is this needed?

To highlight search terms.

How do you think it should be done?

Add another option to the SearchDSL, as well as to the SearchResponse. You can circumvent the SearchDSL by using, but (as far as I can tell), you cannot retrieve the highlight field from the output:

this["highlight"] = withJsonDsl {
    this["fields"] = withJsonDsl {
        this["field_name"] = withJsonDsl { }
        this["another_field_name"] = withJsonDsl { }
    }
}

Will you be able to help with a pull request?
Of course!

Hey Jord, great feature to add. It would need support both on the query side and the response side to extract the results but should not be too difficult. If you want to have a go at it, please go ahead. Otherwise, I might get around to it in the next few weeks.

fixed by #121