如何在 Sphinx 的一个索引中使用多个源?

发布于 2024-08-17 08:18:46 字数 684 浏览 11 评论 0原文

Sphinx 配置文件暗示它支持一个索引的多个源,我实际上如何指定它?

这是配置文件中的片段:

# document source(s) to index
# multi-value, mandatory
# document IDs must be globally unique across all sources
source                  = src1

我尝试将其设置为以下格式:

source = src1, src2
source = [src1, src2]

并且我还尝试使用源变量两次,例如:

source = src1
source = src2

我怀疑我只是个傻瓜,因为我不确定配置文件中使用的语法。有什么想法吗?

使用第二个代码片段时出现以下错误:

ERROR: index 'iwa': fulltext fields count mismatch (me=iwa_publications, in=iwa_events, myfields=3, infields=8).

两个源是 iwa_events 和 iwa_publications。两者都有唯一的 id 列,并且两个源在单独索引时都可以工作。

The Sphinx config file hints to it supporting multiple sources for one index, how do I actually specify it?

Here's the snippet from the config file:

# document source(s) to index
# multi-value, mandatory
# document IDs must be globally unique across all sources
source                  = src1

I've tried setting it in the following formats:

source = src1, src2
source = [src1, src2]

and I've also tried using the source variable twice, eg:

source = src1
source = src2

I suspect that I'm just being a dunce, as I'm not sure of the syntax to use in the config file. Any ideas?

Using the second code snippet I get the following error:

ERROR: index 'iwa': fulltext fields count mismatch (me=iwa_publications, in=iwa_events, myfields=3, infields=8).

The two sources are iwa_events and iwa_publications. Both have unique id columns, and both sources work when indexed individually.

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

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

发布评论

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

评论(3

禾厶谷欠 2024-08-24 08:18:46

如果您想一次搜索多个索引,则必须在 PHP 代码中指定它们,而不是在配置文件中。

只需在 Query 方法中分隔索引即可(请参阅< a href="http://www.sphinxsearch.com/docs/current.html#api-funcgroup-querying" rel="nofollow noreferrer">文档):

$cl->Query ( "test query", "index1 index2" );

根据文档 你可以。
您的第二个代码片段是列出多个源的正确格式。请编辑您的问题以告诉我们您的实际问题是什么。

If you want to search multiple indexes at once you have to specify them in your PHP code, not in the configuration file.

Just seperate the indexes in your Query method (see documentation):

$cl->Query ( "test query", "index1 index2" );

According to the documentation you can.
Your second code snippet is the correct format to list multiple sources. Please edit your question to tell us what your actual problem is.

碍人泪离人颜 2024-08-24 08:18:46

发现问题:我误解了拥有多个来源的意义。看来多个源确实可以在一个索引中使用,但前提是它们在架构方面相同,如文档中的这一行所示:

“源架构必须相同才能存储在同一索引中。”

非常感谢您的帮助,Jan。造成误解是我的错。 :D

Problem found: I misread the point of having multiple sources. It would appear that multiple sources can indeed be used in one index, but only if they're identical in terms of schema, as according to this line in the docs:

"source schemas must be the same in order to be stored within the same index."

Thanks very much for the help, Jan. It was my bad for the misunderstanding. :D

杯别 2024-08-24 08:18:46

是的。源模式必须相同;但你只需要相同数量的字段。
如果需要,您甚至可以使用同一字段两次。只需在所有查询中为字段提供相同的名称:sql_query = select id, catname as one,country as 2,currency as 3, language as 4 from Catalog

yes. source schemas must be the same; but you only need same number of fields.
you can even use same field twice if needed. just give fields same name like this in all queries: sql_query = select id, catname as one, country as two, currency as three, language as four from catalog

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