SQLite enhanced query syntax on Android

只愿长相守 提交于 2019-12-20 03:23:11

问题


I have the following SQLite query which works great on my local machine:

SELECT * FROM ftdata WHERE ftdata MATCH 'phrase1:this AND phrase2:that'

This doesn't seem to return the same resultset on my Android device as it does on my desktop. It returns far less results on Android. This query appears to return the correct results on both:

SELECT * FROM ftdata WHERE ftdata MATCH 'phrase1:this phrase2:that'

However I would ideally like to combine AND and OR queries instead of being forced to use AND.

Are there certain features of the enhanced query syntax that Android doesn't support? Am I using the incorrect syntax in the first instance?


回答1:


Different Android firmwares use different SQLite versions, but the FTS syntax has not changed for a long time.

Your problem is that most (all?) Android vendors do not enable the enhanced query syntax.

You should restrict yourself to queries that work with both syntaxes. Alternatively, execute PRAGMA compile_options to check whether ENABLE_FTS3_PARENTHESIS is set.



来源:https://stackoverflow.com/questions/18672777/sqlite-enhanced-query-syntax-on-android

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