Skip to:
Content
Pages
Categories
Search
Top
Bottom

How to enable search in bbPress plugin

  • @tntc1978

    Member

    First off, I’m sorry to start a new thread here. I commented on one here: http://bbpress.org/forums/topic/about-search-field-in-bbpress-20-beta-3 but unfortunately it got closed, so I can’t comment on it.

    John James Jacoby told me:

    This has been covered in these forums a few times already, which may or may not be an indicator of how little the search functionality gets used. :)

    http://bbpress.trac.wordpress.org/ticket/1575

    But since I actually commented on a thread regarding the issue, it should tell John, that I actually did a search, and I had actually sought for about 30 minutes before writing the question. And a googlesearch also shows me, that it’s the only place linking to the tracticket: http://bbpress.trac.wordpress.org/ticket/1575

    Having said that. When I paste the code it just generates an error and the code in the trac ticket should be this instead:

    function my_add_bbp_to_search( $post_type ) {
    $post_type['exclude_from_search'] = false;

    return $post_type;
    }
    add_filter( 'bbp_register_forum_post_type', 'my_add_bbp_to_search' );
    add_filter( 'bbp_register_topic_post_type', 'my_add_bbp_to_search' );
    add_filter( 'bbp_register_reply_post_type', 'my_add_bbp_to_search' );

    Unfortunately I haven’t figured how to solve these two issues:

    – have pages in search results (I always only get one page shown)

    – show both forumposts and blogposts in search results.

    So any thoughts on these issues would be great.

Viewing 6 replies - 1 through 6 (of 6 total)
  • @pimarts

    Participant

    I tried doing this too. And it worked, in a way. But with that code (I think it was that code I used at least) it enables searching in the forums, but for whatever reason the first result showed up in complete view topic style, including a reply form etc. Which is not really what I wanted for search results.

    Probably something on my end, so I disabled that feature for now.

    Any ideas JJJ?

    @tntc1978

    Member

    Yep. I just saw that too. It shows the entire topic or reply. If you click the topic nothing is wrong, but if you click the reply, it is shown really weird with a commentform under each reply…

    @johnjamesjacoby

    Keymaster

    Without doing some ender the hood trickery, it’s going to be hard to include all results and satisfy the majority of uses.

    bbPress already does some of this to prevent things like rouge comment forms appearing where maybe they shouldn’t. I haven’t been able to come up with a working solution that I think satisfies what 80% of the people using bbPress will want, namely because the WordPress core search function makes what we want to do, a little difficult.

    The other thing that you’re noticing is that all search results look like blog posts. That’s because that’s how the search.php in almost all WordPress themes is coded to look. bbPress can’t really intercept every possible query and scan the post_type for topic/reply, and then inject something different, on every singe possible page load. Well, it could, but I suspect the performance hit would be fairly costly and it probably wouldn’t scale well into millions of entries.

    So, we’re kinda stuck.

    In the meantime, you can append:

    ?ts=whatever

    to search topics, and

    ?rs=whatever

    to search replies in a specific topic, so I do have some logic built in to allow for this… but, it does need some massaging before it’s what I would consider to be ‘correct.’

    @tntc1978

    Member

    Fair enough, and thanks for the great reply.

    I think I will go with Google search for now: http://www.google.com/cse and take a rain-check at a later stage.

    @johnjamesjacoby

    Keymaster

    Sounds like a great idea to me. Hard to beat the best. :)

    @pimarts

    Participant

    In my search.php I only return the title & excerpt. And that works perfectly, until I add the the code above and one of the results is a topic / reply. I assume that’s when bbPress takes over the entire output?

    The first result has the breadcrumbs, “This topic has 1 voice, contains 0 replies, and was last updated by.” line, the style of a topic and a reply form. Pretty much just the whole viewtopic page. The results after that (both replies, topics AND blog posts) only display the content (with HTML in it). No titles on either the first or the replies after that. That’s expected behaviour?

    As for that appending:

    You mean http://www.domain.com/?ts=test or http://www.domain.com/?rs=test? That doesn’t seem to work for me.

    I might want to go the Google search way, but for whatever reason I never liked it when sites implemented that. I can’t really say why though haha.

Viewing 6 replies - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.
Skip to toolbar