• Members 34 posts
    July 30, 2017, 1:32 a.m.

    Hi, there.
    With the help of rafalp, I successfully implemented Fuzz Chinese search in Misago.
    Here is how I did it. It is very easy actually.
    1 Install SCWS(Simple Chinese Word Segmentation)

    wget -q -O - http://www.xunsearch.com/scws/down/scws-1.2.3.tar.bz2 | tar xf -
    

    Note, if you have trouble, try this:

    wget -q -O - http://www.xunsearch.com/scws/down/scws-1.2.3.tar.bz2 | tar -jxv
    

    then

    cd scws-1.2.3 ; ./configure ; make install
    

    2 Download zhparser and install

    git clone https://github.com/amutu/zhparser.git
    
    make && make install
    

    Having trouble installing?
    try this

    - sudo apt-get install postgresql-server-dev-all
    - sudo apt-get install postgresql-common
    

    Having several version of postgresql?
    Try:

    PG_CONFIG=/usr/lib/postgresql/9.5/bin/pg_config make && make install
    

    3 PostgreSql config

    su - postgres
    psql -U postgres db_fts_development
    CREATE EXTENSION zhparser;
    CREATE TEXT SEARCH CONFIGURATION zhcnsearch (PARSER = zhparser);
    ALTER TEXT SEARCH CONFIGURATION zhcnsearch ADD MAPPING FOR n,v,a,i,e,l,j WITH simple;
    

    4 Finish
    In the setting.py of your misago project, change

    MISAGO_SEARCH_CONFIG = 'simple' to MISAGO_SEARCH_CONFIG = 'public.zhcnsearch'
    

    .
    And it's all done. Very easy.
    Now, go to your forum and post something new(old post cannot be searched).
    Note that, a three characters word at least is needed for a search.

    If any question, feel free to ask me.
    Thank all the contributors for such a good forum!

  • July 30, 2017, 2:42 a.m.

    Thank all the contributors for such a good forum!

    Hey, thank you for posting this guide. I'm sure as Misago's chinese community grows, quite a few will find it useful! 👍

    Now, go to your forum and post something new(old post cannot be searched).

    This raises an eyebrow. Misago provides the rebuildpostssearch that will reindex all posts on forum when ran, and I've used it quite frequently when working on different features without fail. Is there anything wrong it?