简体   繁体   English

通过SphinxSE插入

[英]INSERT through SphinxSE

I defined a real-time index (RT index) on SphinxSearch 2.1.8: 我在SphinxSearch 2.1.8上定义了实时索引(RT索引):

index rt
{
    type = rt
    path = /var/lib/sphinxsearch/data/rt
    rt_field = url
}

Then I declared a table in MariaDB 10.0.11 using SPHINX Storage Engine: 然后,我使用SPHINX Storage Engine在MariaDB 10.0.11中声明了一个表:

CREATE TABLE `rt` (
  `id` bigint(20) unsigned NOT NULL,
  `weight` int(11) NOT NULL,
  `query` text NOT NULL,
  `url` varchar(255) DEFAULT NULL,
  KEY `query` (`query`(1024))
) ENGINE=SPHINX DEFAULT CHARSET=utf8 CONNECTION='sphinx://127.0.0.1:9312/rt';

Is it possible to INSERT data into my RT index through the SphinxSE table ? 是否可以通过SphinxSE表将数据插入到我的RT索引中?

When I try to insert, I have this error: 当我尝试插入时,出现以下错误:

MariaDB [mydb]> INSERT INTO rt(id, url) VALUES (1, 'http://www.stackoverflow.com');
ERROR 1031 (HY000): Storage engine SPHINX of the table `mydb`.`rt` doesn't have this option

According to this comment from MariaDB KB it may be possible to INSERT/UPDATE/DELETE a rt index through SphinxSE, but I wonder how... 根据MariaDB KB的这一评论,可能可以通过SphinxSE插入/更新/删除rt索引,但是我不知道如何...

While in theory it's now possible to have it proxy INSERTs, DELETEs and other writes to Sphinx, it was never initially designed for this, so that change could be cumbersome. 从理论上讲,现在可以让它代理INSERT,DELETE和其他对Sphinx的写入,但是它最初并不是为此目的而设计的,因此更改可能很麻烦。

That comment is says it theory possible to modify the source code of the SphinxSE engine, to enable such updates. 该评论说,理论上可以修改SphinxSE引擎的源代码以启用此类更新。 Basically it will instead make a SphinxQL connect to sphinx, and issue appropriate commands. 基本上,它将使SphinxQL连接到sphinx,并发出适当的命令。

But as noted it wasnt designed for that (for example it takes a SphinxAPI port in the table definition - so would need to find another way to tell the engine the SphinxQL port to use) - it will be kind of difficult to do. 但是如前所述,它并不是为此而设计的(例如,它在表定义中使用了SphinxAPI端口-因此需要找到另一种方式告知引擎使用SphinxQL端口)-这将很难做到。

... so not possible now. ...所以现在不可能。 But could be possible if someone wrote the code to do so. 但是,如果有人编写了代码可以做到这一点。

Probably much easier to modify your application to talk SphinxQL directly to Sphinx. 修改您的应用程序以使SphinxQL直接与Sphinx对话可能要容易得多。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM