Skip Navigation

[Resolved] Highlighting search results text – Relevanssi-generated excerpts

This support ticket is created 3 years, 5 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Kolkata (GMT+05:30)

This topic contains 24 replies, has 2 voices.

Last updated by BillD 3 years, 5 months ago.

Assisted by: Minesh.

Author
Posts
#2158221

Hello,
Tell us what you are trying to do?
I am trying to use Relevanssi to search my Toolset custom search for text posts.
I would like to implement highlighting for the search terms in Toolset customs posts (using Relevanssi).
I contacted Relevanssi who asked the following question:
"Is Toolset using Relevanssi-generated excerpts? If it is, the highlighting should happen automatically, but if it's not, then I don't know what it is doing and can't really help you out there."

Is there any documentation that you are following?
I have checked existing forum support and documentation, but cannot find the answer.
Any information or advice would be very welcome.
Best regards,
BillD

#2159765

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

Can you please check the following reference ticket and check if that helps you to resolve your issue.
https://toolset.com/forums/topic/custom-search-relevanssi/#post-492275

#2159947

Hello.
Thank you for your reply.
I'll try this, but need help with the 2nd part.
I have added the PHP code to the function file (and corrected the spelling of highlight).
Please can you tell me where to put the shortcode, below, as I cannot see where it should go?
I used Custom Search Filter in blocks to create the search bar.
Thanks,
BillD

https://toolset.com/forums/topic/custom-search-relevanssi/#post-492275

[hightlight-keyword][wpv-post-excerpt][/hightlight-keyword]

It will be able to search in the text of [wpv-post-excerpt], find and hightlight the keyword

#2161841

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

The shortcode you shared - you should add within the View's loop.

[hightlight-keyword][wpv-post-excerpt][/hightlight-keyword]
#2161943

Thank you for your reply. I've tried, but not succeeded.
Can you please be more explicit?

#2161945

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Can you please share problem URL and admin access details.

*** Please make a FULL BACKUP of your database and website.***
I would also eventually need to request temporary access (WP-Admin and FTP) to your site. Preferably to a test site where the problem has been replicated if possible in order to be of better help and check if some configurations might need to be changed.

I have set the next reply to private which means only you and I have access to it.

#2162061

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

When I try to access the wp-admin it shows the following message:
<codE>
Your access to this site has been limited by the site owner
[/php]

Can you please grant full access.

#2162071

I think it was Wordfence.
Should be ok now.
Let me know if it is not.

#2162077

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Can you please share bit more details with what keyword I should try to search and what you expect?

#2162081

Yes of course.
Please try a search with the term "contract" in "recherche"
I would like to see the term "contract" highlighted using a yellow background where ever it appears in the results.
You can see the option in Settings / Relevanssi / excerpts and highlights.
This is what I am trying to achieve a search using Relevanssi which highlights the terms searched using the toolset custom search box.

#2162087

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

When I try to search with the term "contract" and click on button ""Rechercher" it shows me the following message.

- Sorry, you are not allowed to preview drafts.

#2162097

When I try to search with the term "contract" and click on button ""Rechercher" it shows me the following message.

- Sorry, you are not allowed to preview drafts.

IT SHOULD be ok now. Just need to edit page and update.
Sorry about that.

#2162111

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Its still not working - I get the same error message still.

#2162121

Ok. I have checked again and there are no more restrictions on the page.
I can access it from a different browser and login. You should be able to too.

#2162135

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

I've called the shortcode as given under:

[highlight-keyword][types field='anglais'][/types][/highlight-keyword]

Now, when I search for the keyword "contract" I can see it in yellow color:
=> link replaced