Enhance Highlight Customization using the columns Option
This pull request introduces the utilization of the columns option to create customized highlighting for search results in the PgSearch module. The enhancement offers a more flexible and tailored way to generate pg_search_<custom_name>_highlight columns based on specified columns within the model.
Example:
pg_search_scope :search_by_keyword, against: {
title: 'A',
body: 'B',
summary: 'C'
}, using: {
tsearch: {
prefix: true,
highlight: {
fields: {
title: :title,
content: %i[body summary]
}
StartSel: '<mark>',
StopSel: '</mark>'
}
}
}
Article.by_keyword('account').first.pg_search_title_highlight
=> "How to create <mark>account</mark>?"
Article.by_keyword('account').first.pg_search_content_highligh
=> Select New Agency <mark>Account</mark> and after you create your agency, the <mark>Account</mark> is here."
Enhance Highlight Customization using the columns Option
This pull request introduces the utilization of the columns option to create customized highlighting for search results in the PgSearch module. The enhancement offers a more flexible and tailored way to generate
pg_search_<custom_name>_highlight
columns based on specified columns within the model.Example: