If you are using a postgresql database, check whether the encoding of your database is UTF-8? You can view database information through l in the database shell:
postgres=# \l
List of databases
Name | Owner | Encoding | Collate | Ctype | Access privileges
-----------+----------+-----------+-------------+-------------+-----------------------
db1 | owner | UTF8 | en_US.UTF-8 | en_US.UTF-8 | =Tc/owner +
| | | | | owner=CTc/owner
db2 | owner | SQL_ASCII | C | C | =Tc/owner +
Is it possible to search in Chinese in the database shell? Can be checked via the following sql:
SELECT to_tsvector('我们') @@ to_tsquery('我:*');
The above db1 is UTF-8, so it supports Chinese search,
You can refer to this: https://www.v2ex.com/t/274600...
I used flask-whooshalchemy before, but the Chinese word segmentation effect was not good. Then I used jieba to make the word segmentation table and index, and then whooshalchemy searched the word segmentation table. The effect was okay.
If you are using a postgresql database, check whether the encoding of your database is
UTF-8
? You can view database information through l in the database shell:Is it possible to search in Chinese in the database shell? Can be checked via the following sql:
The above db1 is UTF-8, so it supports Chinese search,
db2 is SQL_ASCII and does not support Chinese search
You can refer to this: https://www.v2ex.com/t/274600...
I used flask-whooshalchemy before, but the Chinese word segmentation effect was not good. Then I used jieba to make the word segmentation table and index, and then whooshalchemy searched the word segmentation table. The effect was okay.