Tuesday, April 10, 2012

How to Enable Search in OSQA

OSQA Logo

OSQA installation does not come with full text search. To enable it a sql data base should be imported in to existing database. In the folder
osqa-server/forum_modules/mysqlfulltext, the fts_install.sql should be imported in to existing database.
To do it 'mysql osqadb -h 127.0.0.1 -u osqauser -p < fts_install.sql'
command should be run with in the folder. However this may end up with following output.

 ERROR 1050 (42S01) at line 1: Table 'forum_mysqlftsindex' already exists

The problem here is forum_mysqlftindex table in already there. So what we have to do is remove the table creation part and to the import.
1st take a copy of fts_install.sql by 'cp fts_install.sql fts_install_nocreate.sql'.
Then open the fts_install_nocreate.sql with vim by 'vim fts_install_nocreate.sql'

Then remove the part of


CREATE TABLE forum_mysqlftsindex (
        id int NOT NULL AUTO_INCREMENT,
        node_id int NOT NULL UNIQUE,
        body longtext NOT NULL,
        title varchar(300),
        tagnames varchar(255),
        PRIMARY KEY (id),
        FOREIGN KEY (node_id) REFERENCES forum_node (id)   ON UPDATE CASCADE ON DELETE CASCADE,
        FULLTEXT (body, title, tagnames),
        FULLTEXT(body),
        FULLTEXT(title),
        FULLTEXT(tagnames)
) ENGINE=`MyISAM`;

and save it.

Then import the modified sql file by 'mysql osqadb -h 127.0.0.1 -u osqauser -p < fts_install_nocreate.sql'

Now search should work.

No comments: