如何实现智能搜索/邮箱功能的存储/检索?

发布于 2024-09-03 17:38:53 字数 643 浏览 5 评论 0原文

我有一个关于智能搜索功能实施的问题。例如,考虑各种电子邮件应用程序中的“智能邮箱”之类的东西。假设您将数据(电子邮件)存储在数据库中,并且根据要为其创建查询的字段,您向最终用户提供不同的选项。目前,我们假设采用主语、动词、宾语方法……

例如,假设您有以下内容:

主题:消息、收件人地址、发件人地址、主题、收到日期
动词:包含、不包含、等于、大于、小于
对象:???????


现在,如果不清楚,我想要一个表结构(尽管我不反对某种外部 XMLesque 文件)来存储(并稍后检索/呈现)我的智能搜索/邮箱标准以供以后使用。例如,使用 SVO,我可以轻松存储然后重建“两个日期之间的日期”的查询 - 只需使用“日期大于”和“日期小于”。但是,如果在同一个智能搜索中,我想要与另一个条件进行“介于”或运算,该怎么办?您可以看到它可能会失控 - 不一定是在查询创建中(因为这相当简单),而是在选项表示和存储机制中。

也许我需要在更细粒度的层面上进行更多思考。也许我需要简单地允许用户独立地为每个条目选择“AND”或“OR”,而不是使其成为“全有或全无”类型的智能搜索(即,而不是“匹配所有”或“匹配任何”,我需要简单地允许他们选择 - 我只是不想让它变成九头蛇)。

任何意见将不胜感激。如果问题有点语无伦次,我很抱歉。已经很晚了,我的大脑已经干涸了。

最好的。

I have a question regarding implementation of smart-search features. For example, consider something like "smart mailboxes" in various email applications. Let's assume you have your data (emails) stored in a database and, depending on the field for which the query will be created, you present different options to the end user. At the moment let's assume the Subject, Verb, Object approach…

For instance, say you have the following:

SUBJECTs: message, to_address, from_address, subject, date_received
VERBs: contains, does_not_contain, is_equal_to, greater_than, less_than
OBJECTs: ???????

Now, in case it isn't clear, I want a table structure (although I'm not opposed to an external XMLesque file of some sort) to store (and later retrieve/present) my criteria for smart searches/mailboxes for later use. As an example, using SVO I could easily store then reconstruct a query for "date between two dates" -- simply use "date greater than" AND "date less than". However, what if, in the same smart search, I wanted a "between" OR'ed with another criterion? You can see that it might get out of hand -- not necessarily in the query creation (as that is rather simplistic), but in the option presentation and storage mechanism.

Perhaps I need to think more on a more granular level. Perhaps I need to simply allow the user to select AND or OR for each entry independently instead of making it an ALL OR NOTHING type smart search (i.e. instead of MATCH ALL or MATCH ANY, I need to simply allow them to select -- I just don't want it to turn into a Hydra).

Any input would be most appreciated. My apologies if the question is a bit incoherent. It is late, and I my brain is toast.

Best.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(1

红尘作伴 2024-09-10 17:38:53

最简单的方法是将所有邮箱信息存储在 SQL 数据库中,并将“主语动词对象”转换为 SQL“where”子句。然后让 SQL 查询编译器为您完成这项工作。

这就是 Apple 在 Mail.app 中所做的,它使用 sqlite 数据库来存储所有邮件标头信息。

The easiest way to do this is to store all of your mailbox information in an SQL database and translate your "subject verb objects" into SQL "where" clauses. Then you let the SQL query compiler do the work for you.

This is what Apple does in Mail.app, which uses an sqlite database to store all of message header information.

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