Customize Joomla Search Result Page with Override

Need help with the Administration of your Joomla! 3.x site? This is the spot for you.

Moderator: General Support Moderators

Forum rules
Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting, this means YOU.
Forum Post Assistant - If you are serious about wanting help, you will use this tool to help you post.
Post Reply
User avatar
DaveOzric
Joomla! Ace
Joomla! Ace
Posts: 1452
Joined: Sat May 22, 2010 10:29 pm
Contact:

Customize Joomla Search Result Page with Override

Post by DaveOzric » Sat Jul 07, 2018 3:26 pm

Hello, a new issue has come up now that I use shortcode in some articles. The search results show this and it's very confusing for a user to see this vs some textual results that make sense. The template/shortcode builder has stated the search does not use the prepared content only the raw database content so no help fixing it there.

So does anyone know how to fix this so the search results show the prepared content shown on the front end of the site?

If there is no way to do this I am thinking perhaps overriding to show meta descriptions vs the article body would suffice. Not really optimal but I would be able to control that part.

Thanks!

User avatar
leolam
Joomla! Master
Joomla! Master
Posts: 19099
Joined: Mon Aug 29, 2005 10:17 am
Location: Netherlands/ UK/ S'pore/Jakarta/ North America
Contact:

Re: Customize Joomla Search Result Page with Override

Post by leolam » Sun Jul 08, 2018 5:28 pm

DaveOzric wrote:Hello, a new issue has come up now that I use shortcode in some articles. The search results show this and it's very confusing for a user to see this vs some textual results that make sense. The template/shortcode builder has stated the search does not use the prepared content only the raw database content so no help fixing it there.
Dave please open an issue for this on the Tracker ? I think it is a valid concern that needs to be addressed in com_search and/or com_finder

Leo 8)
Joomla's #1 Professional Support Provider:
-> Joomla Professional Support: https://gws-desk.com -
-> Joomla Specialized Hosting Solutions: https://gws-host.com -
Member Joomla Bug Squad & Joomla CMS Release Team

mbabker
Joomla! Hero
Joomla! Hero
Posts: 2176
Joined: Sun Feb 28, 2010 8:26 pm

Re: Customize Joomla Search Result Page with Override

Post by mbabker » Sun Jul 08, 2018 6:25 pm

com_search dispatches the `onContentPrepare` event for only the selected text value with the context "com_search.search" (it can't dispatch the event with the full result object, because it doesn't go through the component MVC to do lookups). If a plugin is coded right, it is checking context and only acting in supported cases; from the sound of things they may be doing this but only acting on "com_content.*" contexts.

Even then, it may not be possible to accurately prepare the contents in the way expected in com_search because not all events are dispatched as they are in other component views and the data included in the events is generally lacking in relation to what is included when the events are dispatched in other components.

Lacking or otherwise, trying to change com_search at this point is probably a lost cause. It would honestly be too complex to build result sets correctly and dispatch the appropriate events with said results given how the component and its plugins work and diverting the search to each component's MVC would have a massive performance hit.
So long and thanks for all the fish.

Manually updating Joomla? See https://gist.github.com/mbabker/d7bfb4e ... 3607f89281

User avatar
DaveOzric
Joomla! Ace
Joomla! Ace
Posts: 1452
Joined: Sat May 22, 2010 10:29 pm
Contact:

Re: Customize Joomla Search Result Page with Override

Post by DaveOzric » Wed Jul 11, 2018 12:34 pm

Hi Guys, I found a plugin that helped me but I made an override to the search template to show the article meta description so I will have to add some text in that. Not a great solution but my only choice at this point since the pages are all coded using the template.

Thanks for your input and ideas.

User avatar
DaveOzric
Joomla! Ace
Joomla! Ace
Posts: 1452
Joined: Sat May 22, 2010 10:29 pm
Contact:

Re: Customize Joomla Search Result Page with Override

Post by DaveOzric » Mon Aug 06, 2018 5:00 pm

Hi again, I want to continue this question as the solution I found is way to much work. What would probably work is some type of filtering option or plugin that could hide the [short code which is all wrapped in these] brackets or whatever they are called.

If the search results could only show text that is not in these it would be perfect.

This is an example of an article's content. Any text not wrapped in [] is what needs to be displayed in the search results.

[/text] [text tag="h3" typography="Text {color: #dd6d1d;}"]Descriptive and Predictive Analytics for Real Insight[/text] [text tag="p"]Choice of analytics is key. When the right analytic method is applied to the correct set of KIPs, the results make sense and are usable.[/text] [text tag="p"]Our analytic approach is designed to identify the right set of KPIs for each outcome— recruitment, development and retention—based on the unique characteristics of your company. Retention of top talent is the Holy Grail. Activities within your organization that lead to the retention of top talent are those that need to be identified and targeted for improvement. Performance measurement does exactly that.[/text] [/section] [section title="Form" id="section36" wide=true css="background-color:#313e49;padding-bottom:2em;padding-top:2em;" typography="Text {font-weight: normal;color: #ffffff;}"] [text tag="p" typography="Text {font-weight: bold;}"]Request more information about Monalco Talent Solutions Evaluation Service[/text] [text tag="p" typography="Text {font-weight: normal;}"]For a free no-risk call about our Performance Evaluation Service, please complete the form below.[/text] [html ]

User avatar
DaveOzric
Joomla! Ace
Joomla! Ace
Posts: 1452
Joined: Sat May 22, 2010 10:29 pm
Contact:

Re: Customize Joomla Search Result Page with Override

Post by DaveOzric » Sat Aug 11, 2018 6:21 pm

Solved: Regular Labs Rereplacer Pro solves this issue with regular expressions assigned to the search page.

In case anyone else wants a fairly inexpensive solution to this issue.


Post Reply

Return to “Administration Joomla! 3.x”