Search code examples
mysqlfull-text-searchosqa

Search titles does not work with OSQA on Windows with MySQL - how to resolve?


With OSQA installed using IIS and MySQL, tag search works, however questions search does not. All results show blank.

I read through this post and this one, but I don't see an actual solution. If I missed it can someone please clarify or provide a solution?

I also found this post which refers to this link to download a MySQL module to enable FTS, however that link results in a server error.

Thank you.


Solution

  • I added the contents of fts_install.sql (just do a search for that file) (below). Had to make some small modifications to the INSERT statements, but seems to work:

    ALTER TABLE osqa634.forum_mysqlftsindex CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;
    
    delimiter |
    
    CREATE TRIGGER osqa634.fts_on_insert AFTER INSERT ON osqa634.forum_node
      FOR EACH ROW
      BEGIN
        INSERT INTO osqa634.forum_mysqlftsindex 
        SET node_id=NEW.id, 
            title=UPPER(NEW.title), 
            body=UPPER(NEW.body), 
            tagnames=UPPER(NEW.tagnames); 
      END;
    |
    
    delimiter |
    
    CREATE TRIGGER osqa634.fts_on_update AFTER UPDATE ON forum_node
      FOR EACH ROW
      BEGIN
        UPDATE osqa634.forum_mysqlftsindex 
        SET title = UPPER(NEW.title), 
        body = UPPER(NEW.body), 
        tagnames = UPPER(NEW.tagnames) 
        WHERE node_id = NEW.id;
      END;
    
    |
    
    INSERT INTO osqa634.forum_mysqlftsindex (node_id, title, body, tagnames) 
    SELECT id, UPPER(title), UPPER(body), UPPER(tagnames) FROM osqa634.forum_node;
    

    Seems to do the trick.