• So I am slowly moving forward in my custom search integration using Relevanssi with Bricksbuilder.
    I got it so far that my custom search page template shows the search results.

    Here is my problem: so far it only shows me the titles of the search results (unless it’s a blog post, where I see the default excerpt), I think that Relevanssi generates a custom excerpt of the search result internally, however I have no idea on how to display that.

    I have a “Posts” element on my custom search result page and there I can add fields for dynamic data that I want to be displayed (such as the title of the post or the date when it was posted, it looks like this i.e. {post_title:link} or {post_excerpt}) this works well but it only shows the post excerpt of blog posts and not the indexed pages.
    How do I get the custom Relevanssi excerpt show up there?

    I am new to web development so I might miss a very basic concept here.

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Mikko Saari

    (@msaari)

    This is something where the Bricks support can help you much better. I don’t know anything about Bricks.

    If you have custom excerpts enabled in Relevanssi, Relevanssi places the excerpts it creates in the post object as $post->post_excerpt, where the excerpts usually are. In basic WordPress templating, the standard the_excerpt() will show Relevanssi excerpts.

    I don’t know what Bricks does differently if {post_excerpt} doesn’t show the correct excerpt. The dynamic field may fetch the excerpt directly from the database instead of using what is in the post object. I don’t know – you need to ask Bricks support about this.

    Thread Starter wiggy9000

    (@wiggy9000)

    Thank you Mikko, I will forward this to the Bricks support! Appreciate your thorough response.

    I have the same problem. And I asked the Bricks support about it. They answer that the {post_excerpt} dynamic code uses $post->post_excerpt. But it only shows the original excerpt, not the amended Relevanssi one.

    I tried to enable debugging but without luck. Enabling or disabling does not change anything. How is that supposed to work?

    As an alternative, I enabled logging, and I can see that Relevanssi logs the user search with the appropriate search terms. However, each search is counted double, i.e., each search results in two logged searches with the same term.

    Is there any option I could use to debug what is happening in the console or similar?

    Plugin Author Mikko Saari

    (@msaari)

    The debugging mode doesn’t do anything useful if you’re an admin. It just opens up debugging information for me without admin access to the site. I can add an extra parameter to URLs to see debugging information.

    The problem seems to be that Bricks fetches the post from the database instead of using the post object with the Relevanssi excerpt. One approach is to disable the Relevanssi excerpts, then create them on the fly with

    $excerpt = relevanssi_do_excerpt( $post, get_search_query() );

    Relevanssi doesn’t do anything with Javascript, so there’s nothing to output to the console.

    Thanks for the quick reply. Yes, that works now. However, it is not as convenient as expected. But that seems to be a Bricks issue. When I turn on the excerpt settings, I can still use the styling; otherwise, search terms are marked with <strong>.

    User searches are still double-counted, which also seems to be a Bricks issue.

    • This reply was modified 2 years, 2 months ago by adcgn.
Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Custom Excerpts in Bricksbuilder’ is closed to new replies.