SQLite的FTS4搜索有特殊字符 [英] SQLite FTS4 search with special characters

查看:195
本文介绍了SQLite的FTS4搜索有特殊字符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Android应用程序,它搜索与FTS4虚拟表SQLite数据库的数据。它工作正常,但是当表中的数据包含特殊字符(如'A','E','我','O','U'或'N')SQLite的MATCH函数没有给出结果。我在这一点上失去了。谢谢你。

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.

推荐答案

注意:默认情况下标记生成器是真穷。 为了取得好成绩,你应该实现自定义标记生成器。 路径并非如此简单:

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

  • 找到标记生成器(与词干?)应该满足您的需要,或 开发它
  • 胶水用sqlite.c源
  • 胶水JNI接口包本机库,所以这将是 从Dalvik虚拟机访问
  • 使用NDK来从无到有,$ P $编译sqlite.c ppare动态 库Android版
  • 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

这篇关于SQLite的FTS4搜索有特殊字符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆