Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

How to search the Activity Wall?

I'd like to configure the search mechanism to search the Activity Wall. Could anybody point me in the right direction for making this happen? I'm using the most recent version of Vanilla (2.1).


  • Options
    hgtonighthgtonight ∞ · New Moderator

    Welcome to the community!

    You need to implement a search model that looks through the activity model. Then you need to hook that into the base search model.

    You basically need to construct a query (or, more likely, multiple queries) that will search through the GDN_Activity table, and respect permissions. Check out /applications/vanilla/models/class.vanillasearchmodel.php for an example.

    The actual hooking is pretty simple, as evidenced by Vanilla's included hooks file:

    public function SearchModel_Search_Handler($Sender) {
        $SearchModel = new VanillaSearchModel();

    So, instantiate your model, and execute the search function while passing the base search model into your method.

    All that said, you should get Sphinx up and running if you want some good search stuffs. More info on that here:

    Search first

    Check out the Documentation! We are always looking for new content and pull requests.

    Click on insightful, awesome, and funny reactions to thank community volunteers for their valuable posts.

  • Options
    peregrineperegrine MVP
    edited June 2014

    there is no configurations statement you add to config.php

    1 - however, for guidance and ideas:

    1 - you could look at vanilla/applications/dashboard/models/searchmodel.php

    2 - and the Activity table and/or ActivityComment are the tables you want to perform your search on. decide what columns in those tables and what you want to perform the search on

    if you want to search on comments and share items you might look into ActivityComment table.

    you may need to join the two tables depending on what you want.

    e.g. this will retrieve all Comment with info with % wildcards on each end so, it would sinfonia, info, information.

    SELECT *
    FROM GDN_ActivityComment
    WHERE Body LIKE '%info%'

    you need to research sql , use the searchmodel as your guide on how to properly use search and the sql methods.

    build a view page for displaying results.

    it's a bit of work to do. may not perform well on queries on large activity tables and may slow down performance.

    you could also look into sphinxsearch site and model your own indexing as well.

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • Options

    Thanks guys. This is a great start. I've checked out Sphinx already but couldn't install on my hosted site. I'll probably throw the whole site on my Azure instance and install Sphinx and go from there.
    Thanks again!

Sign In or Register to comment.