SQLite FTS4 search with special characters

纵然是瞬间 提交于 2020-01-23 00:05:25

问题


I have an Android app which searches for data in an SQLite database with FTS4 virtual tables. It works fine, but when the data inside the tables contain special characters (like 'á', 'é', 'í', 'ó', 'ú' or 'ñ') the SQLite MATCH function gives no results. I'm lost at this point. Thanks.


回答1:


Attention: default tokenizer is really poor. To get good results you should implement a custom tokenizer. The path isn't so simple:

  • find the tokenizer (with stemmer?) that should fit your need, or develop it
  • glue it with sqlite.c sources
  • glue a JNI interface to wrap the native library so it will be accessible from the dalvik VM
  • use NDK to compile sqlite.c from scratch and prepare a dynamic library for Android

Here in stackoverflow you should find some good posts to start learning how to do that.

Look at these projects to get some good starting point:

  • sqlite4java
  • sqlcipher


来源:https://stackoverflow.com/questions/12500799/sqlite-fts4-search-with-special-characters

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!