Open zedejose opened 10 years ago
Nice overview, Zé!
I agree with your approach on the dashboard and core functions. Merging the results is the issue here.
Philosophical speaking, geeSearch Plus was meant to inject a list of posts (pages, custom post types) matching a certain search criteria into the main search query, without messing with the templates (search.php or other).
So, it seems that your idea of converting BP Search Everything results as WP_Post objects and inject them into $wp_query at the very end of method 'extend_search_at_wp' could do the magic.
Pressure points of this approach (the way I see it):
Following this conversation on FB, I'd like to start a conversation about extending the plugin's search scope to BuddyPress components.
The way I see it, it would need (at least) 3 enhancements:
Additional settings on the dashboard
Basically allowing the user to switch on/off which BP components should be searched. Looks pretty easy to implement, thanks to your very handy admin functions. I've tried it like the example below, in /inc/class-gsp-admin.php:
The search functions themselves
Which would be a variation of the ones used in my plugin, see https://github.com/zedejose/bp-search-everything/blob/master/includes/bp-search-everything-functions.php
Adding the BP results to the global search results
This is where I hesitated. BP Search Everything returns x of each component, with a link to further results. The logic behind this is that BP content is stored in different tables and (mostly) not in a format compatible with the WP_Post object, which is what gSearch is returning (via a WP_Query object).
The only way I can imagine to do this without a major architectural refactoring (and I may very well be wrong), is to create "pseudo-posts", i.e. arrays of
$var = new WP_Post()
, and array_push'ing those into the query results._The above approach, by the way, would have the benefit of allowing for a theoretically limitless extension of the plugin, since virtually any WP or direct SQL search query results could be added to the object_
In short
This was an idea of an approach, I'm not even sure it's the best one, but I'd like to discuss it.