User:Hef/rt search: Difference between revisions

From Pumping Station One
Created page with "<pre> Going to run the following in the DB: CREATE TABLE AttachmentsIndex ( id BIGINT NOT NULL, weight INTEGER NOT NULL, query VARCHAR(3072)..."
 
 
(12 intermediate revisions by the same user not shown)
Line 1: Line 1:
<pre>
Log into mariadb as root and run <code>INSTALL SONAME 'ha_sphinx';</code> then <code>show engines;</code> to confirm it worked


Going to run the following in the DB:
== Create Table ==
    CREATE TABLE AttachmentsIndex (
        id    BIGINT NOT NULL,
        weight INTEGER NOT NULL,
        query  VARCHAR(3072) NOT NULL,
        INDEX(query)
    ) ENGINE=SPHINX CONNECTION="sphinx://127.0.0.1:3312/rt" CHARACTER SET utf8


<pre>
CREATE TABLE AttachmentsIndex
(
    id          BIGINT NOT NULL,
    weight      INTEGER NOT NULL,
    query      VARCHAR(3072) NOT NULL,
    group_id    INTEGER,
    INDEX(query)
) ENGINE=SPHINX CONNECTION="sphinx://127.0.0.1:9312/rt" CHARACTER SET utf8;
</pre>


== More output ==


You can now configure RT to use the newly-created full-text index by
I added The following to RT_SiteConfig.pm
adding the following to your RT_SiteConfig.pm:


<pre>
Set( %FullTextSearch,
Set( %FullTextSearch,
     Enable    => 1,
     Enable    => 1,
Line 20: Line 25:
     Table      => 'AttachmentsIndex',
     Table      => 'AttachmentsIndex',
);
);
</pre>


Below is a simple Sphinx configuration which can be used to index all
Below is a simple Sphinx configuration which can be used to index all
Line 25: Line 31:
ideal; you should read the Sphinx documentation to understand how to
ideal; you should read the Sphinx documentation to understand how to
configure it to better suit your needs.
configure it to better suit your needs.
<pre>


source rt {
source rt {
Line 56: Line 63:


searchd {
searchd {
     port                    = 3312
     port                    = 9312
     log                    = /opt/rt4/var/sphinx/searchd.log
     log                    = /opt/rt4/var/sphinx/searchd.log
     query_log              = /opt/rt4/var/sphinx/query.log
     query_log              = /opt/rt4/var/sphinx/query.log
Line 67: Line 74:
     unlink_old              = 1
     unlink_old              = 1
}
}
</pre>
</pre>
== Prime things ==
    sudo groupadd sphinx
    sudo useradd -g sphinx -d /usr/share/sphinx/ -s /bin/false sphinx
    sudo chown -R sphinx:sphinx /var/lib/sphinx/
    sudo -u sphinx indexer --all
    sudo systemctl start sphinx