HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

Using Sphinx for Search

I want to use the Sphinx indexer for searching instead of the fulltext search that comes with Vanilla. I know there's the Sphinx Search plugin, but it's old and unmaintained (I've tried to fix it up a bit, but it's actually quite complex), and I read in another post that the hosted version of Vanilla uses Sphinx. I have looked at the code (I'm primarily a Python dev, my PHP is sketchy), but it doesn't look like it's easy to actually use a different search engine.

@Linc would you be able to give some guidance on potentially how to do it? I'm happy to take a stab at coding it up, but I'd appreciate some pointers in the right direction. Thanks!

Comments

  • BleistivtBleistivt Moderator

    Sphinx search is not that old:
    https://github.com/bauerjj/SphinxSearchPlugin

    It's probably a lot easier fixing that instead of writing it from scratch.
    Enable Vanilla debug mode and PHP logging to catch any errors.

    Just a guess:
    Older plugins that use a lot of classes in non-standard folders may be incompatible with Vanillas new autoloader.
    Try creating a file /conf/bootstrap.early.php with <?php Gdn_Autoloader::start();(or add it in case you already have such a file).

  • R_JR_J Admin

    I've started looking at it. Step one is easy : replace include with include_once and it can be enabled

    The settings page is not correct. I haven't had the time to look at that by now

  • LincLinc Admin
    edited May 2018

    @raoul said:
    @Linc would you be able to give some guidance on potentially how to do it?

    We replace the SearchModel entirely by adding this to the top of the addon file before the class begins:

    if (!class_exists('SearchModel', false)) {
        require_once __DIR__ . '/class.searchmodel.php';
    }
    

    That adds the plugin's custom class.searchmodel.php, which safely blocks the default one from being loaded by core. It's not a great system, but it's currently working.

Sign In or Register to comment.