Search is Back
  • MarkMark
    Posts: 4,880
    Try it out - let us know what you think. If you are a Vanilla 2 early adopter (ie. you've downloaded a copy of Garden/Vanilla from GitHub and you're running it somewhere), there are instructions on how to update your database for search here:

    http://vanillaforums.org/blog/search-is-back-baby/
  • awesome just upgraded and it seems to be working quite well! Also all my old posts from my vanilla 1 forum that was imported are now searchable as well! and its FAST! thanks dudes.
  • Awesome, I cannot wait until it's out of beta ;)
  • Very nice! It seems as if the search function doesn't reveal the content of 'private' discussions anymore.
  • MarkMark
    Posts: 4,880
    @flobster - Yep, that's fixed, too :)
  • Is there a way to search for a thread and not just the comments within the thread?
  • MarkMark
    Posts: 4,880
    @dejitaru - it searches both by default.
  • ahh ok.When you click on the forum it takes you to the middle of the thread and you have to hit more comments to get to the end of the thread. Id rather have it take me to the end of the thread. More of a preference I guess.
  • MarkMark
    Posts: 4,880
    @dejitaru - I don't follow. The way Vanilla works is that it remembers the last comment you read in discussions, and then takes you to that one the next time you visit a discussion (so you can pick up where you left off).

    When it comes to searching, it takes you to the comment you clicked on in the list of search results - wherever that may be in the discussion.
  • @mark ahh I think ive figured it out. Most of the search results are comments and the actual thread is like the 10th result. But you cant differentiate between comments and threads until you hover over the result title. For example I have a thread titled anime when I search anime the first 9 results are comments.How does search determine result order?
  • MarkMark
    Posts: 4,880
    @dejitaru - I'm going to have to defer to @Todd on that (he wrote all of the search stuff), but I imagine it is using MySQL's fulltext relevance order.
  • ToddTodd
    Posts: 1,436
    Search uses fulltext search ranking so it's just based on how relevant MySql thinks the comment/topic is to your search.

    Actually @dejitaru I'm thinking that in the case of a search going to a whole discussion it should go to the first comment, whereas going to a discussion through the main discussions list will go to the unread one. I guess it's not that big of a deal either way.

    Vanilla co-founder

  • Ahh ok makes sense thanks for the info.
  • Todd -

    Where is the alter table commands in the code? I had already added full text searching to my copy and I want to see what I need to delete/alter.
  • Never-mind, it displays them to you when you do the upgrade.
  • fredwufredwu
    Posts: 18
    The search unfortunately doesn't work very well due to the limitation of using MySQL's built-in search.

    Anyone interested in a search plugin that uses Zend_Search_Lucene? Although Zend's implementation is not that good... :-|
  • LouisLouis
    Posts: 88
    I don't know what I'm doing wrong -- I installed a fresh copy off github master branch, search for a post I just made, and I get 0 results, no matter what keyword I try. The link given in the blog didn't work, it said no updates were necessary.

    What should I look for in the SQL? Oh and when I search for nothing, I get an error message from PHP.
  • fredwufredwu
    Posts: 18
    @Louis, turn on the Debugger plugin and look for the quries there?
  • LouisLouis
    Posts: 88
    Oh duh. k, one sec. I searched for "write", a word in my discussion, and it said No results found but made the following SQL:
    Gdn_SearchModel->Search('write', 0, 20)0.013198s
    select *
    from (
    select match(d.Name) against('write') as `Relavence`, d.DiscussionID as `PrimaryID`, d.Name as `Title`, c.Body as `Summary`, concat('/discussion/', d.DiscussionID) as `Url`, d.DateInserted as `DateInserted`, d.InsertUserID as `UserID`, u.Name as `Name`
    from GDN_Discussion d
    join GDN_Comment c on d.FirstCommentID = c.CommentID
    join GDN_User u on d.InsertUserID = u.UserID
    where match(d.Name) against ('write')
    union all
    select match(c.Body) against('write') as `Relavence`, c.CommentID as `PrimaryID`, d.Name as `Title`, c.Body as `Summary`, concat('/discussion/comment/', c.CommentID, '/#Comment_', c.CommentID) as `Url`, c.DateInserted as `DateInserted`, c.InsertUserID as `InsertUserID`, u.Name as `Name`
    from GDN_Comment c
    join GDN_Discussion d on d.DiscussionID = c.DiscussionID
    join GDN_User u on u.UserID = d.InsertUserID
    where match(c.Body) against ('write')
    ) s
    order by s.Relavence desc
    limit 20;
    I'm not sure why but when I execute the second statement in the union without
    where match(c.Body) against ('write')
    it does seem to work -- e.g. the following:
     select match(c.Body) against('write') as `Relavence`, c.CommentID as `PrimaryID`, d.Name as `Title`, c.Body as `Summary`, concat('/discussion/comment/', c.CommentID, '/#Comment_', c.CommentID) as `Url`, c.DateInserted as `DateInserted`, c.InsertUserID as `InsertUserID`, u.Name as `Name`
    from GDN_Comment c
    join GDN_Discussion d on d.DiscussionID = c.DiscussionID
    join GDN_User u on u.UserID = d.InsertUserID
    returns the 1 comment, with a relevance of 0. I figure perhaps then if the where statement, the relevance column, is 0, then that means exclude it rather than return it ... so with such a tiny dataset (one comment in one discussion), could that cause problems?
  • LouisLouis
    Posts: 88
    Made an issue for this and a few other things at http://github.com/lussumo/Garden/issues/issue/245 in the hopes that this system is actually being used. Search is a bit of a deal breaker if still broken, as is a cosmetic bug where it counts the number of role assignments rather than users.
  • MarkMark
    Posts: 4,880
    @Todd wrote the mysql fulltext implementation. Mentioning him here so he can add 2c.
  • Well, found the fix for an empty query and the view crash. Just replace /applications/garden/views/search/index.php content with this code. The view is the only place where the query is not being checked (to be more precise, ResultSet variable from controllers body).
  • ToddTodd
    Posts: 1,436
    Pushed the fix to github. Thanks guys.

    Vanilla co-founder

  • ToddTodd
    Posts: 1,436
    @Louis. I just noticed that your bug was different than what I fixed. However I am guessing that what you are experiencing comes from only having one post in your test forum. I do believe that if a word occurs in more than 50% of the rows in a table then it will be ignored for search purposes.

    This is by design in MySql. Can you maybe add a few more posts and see if you can search then?

    Vanilla co-founder

  • LouisLouis
    Posts: 88
    The forum has just 5 posts, when I search for "Winter", it works, when I search for "write", it doesn't find that one post. I suspect maybe if only one result is found, it returns a relevance of 0, as in relevance should be ignored?

    I'll turn on the debug mode right now, so you can see for yourself. [Edit: Crap, of course, debug mode won't let you run the SQL queries as I did above, but ... I'll try running them again then.]
  • LouisLouis
    Posts: 88
    Never mind. It seems to work now ... not sure what changed in the last 2 minutes besides turning on the debugger. It reports a relevance of 2.38214707374573 for that one post.

    I guess I would hope there'd be some way of saying a word is *too* relevant. Or a way of overcoming that limitation. But it's a minor point, as most forums have that kind of "word is too common" limitation, like phpBB or SMF.
  • ToddTodd
    Posts: 1,436
    Yeah. The relevance is kind of locked away in the logic of MySQL, but I think it works well on balance. I'm also guessing that MySQL's full text indexes might lag behind the data a tad as do with most of these type of searches.

    Vanilla co-founder

  • ToddTodd
    Posts: 1,436
    Another thing. There is another search mode where you can specify simple boolean logic with a + or - before a term similar to search engines. This might give you close to what you want, but is supposed to be slower.

    I'll put a hidden config option in the application for you to try if you want.

    Vanilla co-founder

  • LouisLouis
    Posts: 88
    I wonder if maybe, only for searches which return 0 results, we could swap to a non-relevance based search, perhaps instead a recency-sorted one for just that keyword. And then say "search term too common, results sorted by most recent". If such a generic search reveals nothing, then we know for sure that the word or terms were never used. Perhaps if this uses more CPU or something, it could be a checkbox-- or maybe there's some other trick people are using?
  • bennobenno
    Posts: 49
    Inspires me to work on my sphinx search plugin - nice work on the new search @Todd!
  • [-Stash-][-Stash-]
    Posts: 2,610
    Lucene would be even better, but this is still one hell of an improvement over V1.

    Perhaps the styling of the search results could be slightly different for discussion results (the entire thread) compared to comment results (a single post)?

    Also, I don't know if this is relevant, but the addons/plugins search is currently very annoying, since I can search for a plugin by name and although it finds it, it is MILES down the pecking order. Just try it with something like "JQuery" for example :P Also, my preference of V1/V2, recent/popular is not remembered which is pretty annoying.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Login with Facebook Sign In with Google Sign In with OpenID Sign In with Twitter

In this Discussion

Who's Online 6

AltazarIdanglownashirax00xvik