Vanilla 1 is no longer supported or maintained. If you need a copy, you can get it here.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
Search in both topics(discussions) and comments
Hi all,
I'm customizing Vanilla. Already have done a lot of custimized work, but now I'm stuck with this.
I need to customize the search option in such a way it will search both in comments and in topics(discussions). It should display results in the same way the "comment" search is displayed in this page. If the keyword(s) is(are) found in a discussion, then the 1st post text should be displayed in the results list.
I have the SQL sentence to show these results; it's fairly trivial and easy. But I don't know how to use it. I've taken a look into the code and I see the search method has to be used for one of these classes: topic, comment or user.
Do I have to create a new class, maybe called "all"? I don't see the point of this. Lots of work for a simple feature.
I don't even know how to deal with the query class. My SQL query should have a subquery and a union. Can this be accomplished with it or should I make the query directly?
As you can see, I'm a little lost with this. Any help will be greatly appreciated ;)
0
This discussion has been closed.
Comments
Here is my draft.
Now if you have a working SQL query, I wonder if you implemented a pagination management within it, because you'll need to.
What you could do is to replace my code in the constructor of MultiSearchForm
}else if ($this->Search->Type == 'MultiSearch') { // ... }
and build $this->Data and $this->DataCount with your own query using $this->Context->Configuration['SEARCH_RESULTS_PER_PAGE'], $CurrentPage and $this->Search, because that's what it's all about now I think. Then do a pretty results display in Render_NoPostBack() of MultiSearchForm.