Android 中搜索数据库表的搜索功能

发布于 2024-09-13 06:45:17 字数 271 浏览 8 评论 0原文

我已经使用 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

心凉怎暖 2024-09-20 06:45:17

您是指当您开始输入搜索关键字时出现的自动建议功能吗?如果每次用户输入密钥时都要查询数据库,那么速度会非常慢。您需要提前建立单词索引。

请参阅我的回复以及代码示例:
如何在我的 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?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文