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
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?
- sudo apt-get install postgresql-server-dev-all - sudo apt-get install postgresql-common
Having several version of postgresql?
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;
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!