Sphinx MySQL 子查询无法正常工作

发布于 2024-12-16 00:06:28 字数 973 浏览 1 评论 0原文

我正在开发增量更新脚本,每次尝试使用此命令时:

SELECT id, title, search
FROM related
WHERE id >
(
   SELECT max_doc_id
   FROM sphinx_delta
   WHERE counter_id = 2
)

在 phpMyAdmin 中运行该命令将返回 10 个结果。

SELECT id, title, search
FROM related
WHERE id > 1010 

在 phpMyAdmin 中运行该命令将返回相同的 10 个结果。当然,从子选择返回的值是 1010。

唯一的问题是,当我在 Sphinx 搜索中使用第一个查询时,它返回 0 个结果,而第二个返回 10 个结果。我不知道出了什么问题,两个查询都在 MySQL 中完美运行,并且我使用了 Sphinxs 网站上的教程来制作配置文件。

这是我的配置文件中的部分:

    source delta2 : related
    {
            type        = mysql

            sql_host    = localhost
            sql_user    = *
            sql_pass    = *
            sql_db      = base
            sql_port    = 3306

            sql_query   = SELECT id, title, search FROM related WHERE id > (SELECT max_doc_id FROM sphinx_delta WHERE counter_id = 2)
    }

我尝试将其发布到 Sphinx 的论坛上,但收到 0 条回复。任何建议,我从 0.9.9 迁移到最新版本希望它能修复它,但它无法修复它。

I'm working on a delta updating script and every time I try to use this command:

SELECT id, title, search
FROM related
WHERE id >
(
   SELECT max_doc_id
   FROM sphinx_delta
   WHERE counter_id = 2
)

Running that in phpMyAdmin would return 10 results.

SELECT id, title, search
FROM related
WHERE id > 1010 

Running that in phpMyAdmin would return the SAME 10 results. Of course the value returned from the sub select, is 1010.

The only issue is, when I use the first query in Sphinx search, it returns 0 results, while the second one returns 10 results. I have no idea what's wrong, both queries work perfectly in MySQL, and I used the tutorial on Sphinxs website to make the config file.

Here's the portion from my config file:

    source delta2 : related
    {
            type        = mysql

            sql_host    = localhost
            sql_user    = *
            sql_pass    = *
            sql_db      = base
            sql_port    = 3306

            sql_query   = SELECT id, title, search FROM related WHERE id > (SELECT max_doc_id FROM sphinx_delta WHERE counter_id = 2)
    }

I tried posting this on Sphinx's forum, but got 0 responses. Any suggestions, I migrated from 0.9.9 to the latest version hoping it would fix it, it wasn't able to fix it.

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

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

发布评论

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

评论(1

太阳男子 2024-12-23 00:06:29

您正在更新增量,同时尝试从...增量读取? sphinx 不会更新索引,它会重新创建索引,没有任何内容可供读取。

You are updating the delta while trying to read from the ... delta? sphinx doesnt update indexes, it recreates them, there is nothing to read from.

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