Opened 13 years ago
Closed 12 years ago
#3816 closed defect (bug) (wontfix)
Returning a list of posts by tag keyword returns erroneous data
Reported by: |
|
Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | 1.5.1 |
Component: | Forums | Keywords: | |
Cc: |
Description
using the bp_has_forum_topics() loop with arguments of 'tags' and 'search_terms' only returns one topic with the search terms in tags. Subsequent return values are ones in which the search terms match the topic title, not the tags.
A full description of the source of the problem, and possible steps to rectify, can be found in the first post of: http://buddypress.org/community/groups/how-to-and-troubleshooting/forum/topic/missing-sql-in-get_global_topic_count-function-tags-not-being-searched-properly/
Change History (3)
#1
@
13 years ago
- Component changed from Groups to Forums
- Milestone changed from Awaiting Review to 1.6
#2
@
13 years ago
- Milestone changed from 1.6 to Future Release
OK, I've been digging through this a bit more, and I have a few thoughts about it.
First, our forum functions are simply not designed to query against a tag *and* a search term at the same time. I have dug into BB_Query a bit, and I guess this actually isn't a limitation of bbPress - it's just a problem with our implementation. Search terms and tags get passed through our query stack via the same parameter, and tags always win out. You can read through the logic starting at http://buddypress.trac.wordpress.org/browser/tags/1.5.2/bp-forums/bp-forums-template.php#L307. Note how, when it's a tag query, the search_terms passed to the loop are simply overridden. (Later in the chain, it becomes part of a generic 'filter' parameter.) I don't really understand the logic behind this decision; it goes back at least to http://buddypress.trac.wordpress.org/changeset/2641.
Second, I'm afraid I'm not 100% certain I understand (and can reproduce) the exact problem as you've described it in the linked forum post. When I do tag queries or searches, the total topic count is calculated correctly. It could be that your issue only really arises in cases where you're trying to do a tag AND a search query at the same time, in which case fixing the topic count would be a band-aid on a larger and still unresolved issue (see previous paragraph). Or it could be that I'm misunderstanding your bug report. When you say "subsequent return values", does that mean that you're doing more than one bp_has_forum_topics() loop *on the same page*?
It'd be possible to rewrite relevant sections of bp_has_forum_topics(), and the rest of the BP chain that leads to the query, so that it handles tags and search terms together properly. However, this will be a lot of work (both for the code and for the testing). And the deprecation of bbPress 1.x integration is slated to begin with BP 1.6 (see http://buddypress.trac.wordpress.org/ticket/3598), so all of that work would have an increasingly limited impact. Given this fact, and given the amount of work remaining on the rest of the milestone http://buddypress.trac.wordpress.org/report/3, I'm wary of spending the time to patch this myself.
I would be delighted to work with someone who wanted to make a first go at such a patch, of course. But, barring that, I think that this ticket will probably get marked wontfix. Or, if I'm totally misunderstanding everything, please let me know about that too :)
#3
@
12 years ago
- Milestone Future Release deleted
- Resolution set to wontfix
- Status changed from new to closed
Marking as wontfix as we are/have moved to bbPress 2, and enhancements to bbPress 1 aren't the best use of our limited time (plus, no-one else appears to have been sufficiently moved by this ticket to comment on it in the last 15 months).
I'm pretty sure this is a limitation in the bbPress 1.x query api. Tag searches are, essentially, a subset of regular searches, so there's no way to do a search within a tag.
If this is true, we should probably do some checking in bp_has_forum_topics() that prevents multiple values from being passed like this.