-
Notifications
You must be signed in to change notification settings - Fork 369
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
Question about searching against multiple attributes with highlight #336
Comments
I would also like to see there to be Is there a way to do this right now ? |
This is still an issue :( |
Still and issue |
This would be very helpful. Is there a recommended workaround for searching multiple columns and then displaying results as individual highlighted fields? |
Any updates on this? |
I think this is due to the fact that it's using a If you examine the SQL query, you'll see something akin to: SELECT ((ts_headline('simple', (coalesce("articles"."tsv"::text, '')), (to_tsquery('simple', ''' ' || unaccent('test') || ' ''' || ':*')), 'StartSel = "<mark>", StopSel = "</mark>", MaxFragments = 2'))) AS pg_search_highlight,
articles.*
FROM "articles"
INNER JOIN
(SELECT "articles"."id" AS pg_search_id,
(ts_rank(("articles"."tsv"), (to_tsquery('simple', ''' ' || unaccent('test') || ' ''' || ':*')), 0)) AS rank
FROM "articles"
WHERE (("articles"."tsv") @@ (to_tsquery('simple', ''' ' || unaccent('test') || ' ''' || ':*')))) AS pg_search_906c7ff47cd7c682246c27 ON "articles"."id" = pg_search_906c7ff47cd7c682246c27.pg_search_id
ORDER BY pg_search_906c7ff47cd7c682246c27.rank DESC,
"articles"."id" ASC
LIMIT 10 |
When performing tsearch with Highlighting, the resulting query result concatenates the searched columns with a space. It can be hard to extract the different column data result if both data are text (containing spaces). In order to avoid this issue, we can allow users to customize the columns separator (which needs to be one of the word boundaries used by the query dictionnary). Partial solution for Casecommons#336.
When performing tsearch with Highlighting, the resulting query result concatenates the searched columns with a space. It can be hard to extract the different column data result if both data are text (containing spaces). In order to avoid this issue, we can allow users to customize the columns separator (which needs to be one of the word boundaries used by the query dictionnary). Partial solution for Casecommons#336.
Seeing that this is still an issue in 2023, I have made a pg_search_multiple_highlight gem that is supposed to solve the issue of multiple highlighting. Please give it a try |
I have the following
pg_search_scope
on my model:I would like to return the full
title
anddescription
, with both of them including the highlights, is this possible?The text was updated successfully, but these errors were encountered: