How bbPress search should work?

Published on: November 26, 2012 |Tags: , | Categories: Articles, Technology

There was an interesting discussion during the last bbPress dev meeting about the different approaches for implementing a solid search feature for the forums, and how it should play along with the general WordPress search. Here’s the main ticket. I’d like to keep the dialog going and will summarize the core ideas.I’m writing this without reviewing the whole chat and didn’t take notes, so… sorry in advance if I’m missing someone’s opinion or idea. Please do let me know in the comments.

bbPress side of things

Let’s concentrate first on how the bbPress search should work. Specifically, what should you get when you search for a keyword. There seems to be three main approaches:

Search all, return all

When you search for a keyword, bbPress looks for its custom post types (Forums, Topics and Replies) and will return all items that match the keyword. It should show in the search results template what kind of element each link corresponds to. Maybe it’d make sense to show results for Forums at the top, and Topics+Replies next. For this kind of search, returning items ordered by recency seems to be the logic way to go.

Search replies, return replies

Pretty much the same as the last approach, but the results will only contain links to replies. I think someone mentioned phpBB does this, but I’m not sure. This approach seems best suited for a forum where recency has a lot of weight (news, tech, etc).

Search replies, return topics

In this case bbPress will look for the keyword in replies, but return only the parent topics of those matched replies. Of course it’d show each topic only once. Interestingly, here, the results could be ordered by relevance instead of recency (the count of replies in that topic that match the searched keyword). I’m totally biased, because almost all my experience with bbPress is implementing big scale support forums, and for support this approach wins every time.

Regardless of the approach, we should also consider the idea of having an advanced search mode out-of-the-box, where you could, at least, filter on which Forum you want to search. Maybe make it context aware? If I’m in a Forum, it searches within this forum. If I’m at a Topic it searches within it’s replies.

Let’s not forget pages & posts!

The second part of the discussion is harder to solve. How bbPress search should integrate with the standard WordPress search? Here we agreed this seems more like an UX problem than a technical one. Again, a couple of different approaches:


By far, the easiest to implement. Let’s just have a different search box for bbPress, use a different query_var, keep the bbPress custom post types defined as exclude_from_search and off we go. (Actually, jjj showed us that this is kinda already implemented, at least for topics: example)

Independent but unified

Use the same WordPress search form, but when the users initiate a search from a non bbPress page, run the normal search. If the user searches from inside a bbPress page, run our search. I’ve implemented this in the past and I don’t like it. It’s quite confusing to get different behaviors for the same action.


Again, totally biased, but I love how we resolved this here at Modern Tribe (example). I think for some sites it’d be a killer feature the ability to combine results like that. To be honest, I can’t think of a bbPress implementation I’ve done that would not be well served with a search results page like this one. On the other hand, the general consensus was that making something like this look good in any theme would by quite impossible. Specially when you realize we need to take into account custom post types, different ratios of content in each content type, etc.

I’m probably forgetting parts of the discussion, and this is getting long, so I’ll shut up now and make room(?) for you in the comments. What do you think?

4 Responses to How bbPress search should work?

  1. Pingback: bbPress Search - Daniel Dvorkin's take on WordPress

  2. Doug Smith says

    I prefer an integrated approach but had been thinking only along the lines of giving the visitor some control of what was searched as part of the search form. My thinking is that there is useful content all over my site I would like to make discoverable if it meets the searcher’s need, but there may be times limiting the search scope would be desirable if it can be provided in an intuitive way.

    I hadn’t put much thought into the results side of things until I saw your integrated example. It is now clear to me that both the search mechanism and the results are equally important to provide a great experience for our visitors.

  3. Nashwan Doaqan says

    I can’t wait to test bbPress 2.3 on the wild soon , Currently I developed my own why to improve bbPress search functionality , I used some hooks to separate the WP from bbPress post types and decided a individual search page for forums .

    I really like the approaches “Search replies, return topics” , ‘Independent’ :)

  4. Audrey says

    Thanks for the post, really appreciated.