Android 中搜索数据库表的搜索功能
我已经使用 android 搜索对话框实现了搜索功能,以使用 LIKE 查询搜索表的多个列,但是搜索变得很慢,因为我以这样的方式编写了查询,每次每个列的文本字段(如示例字段标题、描述类别等)将被搜索。
title LIKE "---"OR description LIKE ''---"OR.....category LIKE "---"
OR location LIKE"---"to.
那么有没有其他方法可以加快功能速度。
I have implemented the search functionality using the android search dialog to search multiple columns of a table using LIKE query, but search became slow as I have written a query in such a way that every time the text of each field(like the sample fields title, description category etc.) will be searched.
title LIKE "---"OR description LIKE ''---"OR.....category LIKE "---"
OR location LIKE"---"to.
So is there any other way to speed up the functionality..
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您是指当您开始输入搜索关键字时出现的自动建议功能吗?如果每次用户输入密钥时都要查询数据库,那么速度会非常慢。您需要提前建立单词索引。
请参阅我的回复以及代码示例:
如何在我的 Android 应用程序中使用 QuickSearchBox?
You mean the automatic suggestions feature that come up when you start typing the search keyword? If you'd be querying the database each time the users enters a key, that will be quite slow. You need to build the words index in advance.
See my reply with a code sample here:
How to use QuickSearchBox in my Android application?