Support » Plugin: WordPress Sphinx Search Plugin » Filtering post types

  • We are using bbpress and a few other plugins, and I’d like to be able to choose whether or not to include the “forum” post type when searching. We also have some internal-use-only post types I would prefer not to index at all.

    Where can I customize or filter those? I’m poking around in the code but not sure where to start.

Viewing 2 replies - 1 through 2 (of 2 total)
  • I managed to filter out the stuff I didn’t want by adding a link to the sphinx config explicitly including only the ones I did.

    p.post_status = 'publish' \
            group by p.ID


    p.post_status = 'publish' and \
    	p.post_type IN ('post', 'topic', 'reply', 'page') \
            group by p.ID

    Since I don’t see any filters / hooks in the plugin I guess I’ll have to fork it to support selectors for custom post types.

    I managed to add filters for my custom post types with a few tweaks to the plugin code.
    The basic process, for anyone who wants to do it on their own:

    Modify sphinx.conf to include a new attribute, isForum (or whatever post type) and edit all four sql statements to query this post type.

    Edit /wordpress-sphinx-plugin/php/sphinxsearch_frontend.php and mimic the structures used for comment/post/page/tag filtering. There are a handful of places this needs to be done.

    Edit the widget/panel template files to include the appropriate checkboxes.

    Obviously these changes will be lost on update, so right now I’ll have to hand-merge updates. I’m going to try to write a few hooks that would make this a more generic process for others, if you’re accepting mods to the plugin.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Filtering post types’ is closed to new replies.