认为 Sphinx Delta 索引不起作用

发布于 2024-12-08 14:55:03 字数 1019 浏览 3 评论 0原文

我已将增量列添加到我的表中:

class AddDeltaIndexToCimgs < ActiveRecord::Migration
  def change
    add_column :cimgs, :delta, :boolean, default: true, null: false
  end
end

我迁移了,

我还添加了define_index:

define_index do
  indexes search_cache
  has :approved
  set_property delta: true
end

并且我运行了rake任务

rake ts:stop
rake ts:index
rake ts:start

或rake ts:rebuild

然后我向表中添加了一条新记录,搜索它。 ..什么也没有。 可以完美找到核心索引记录,但增量根本不起作用。

为了搜索它们,我使用以下命令:

Cimg.search query, with: {approved: true}

是的,每个 Cimg 都经过批准,并且在 search_cache 中有一堆内容,并且新内容在数据库中标记为 delta=1。我仔细检查了。

我检查了 db/sphinx 文件夹,并创建了许多名为 cimg_delta 的文件。

这是生成的配置文件: http://pastebin.com/z0fHr43k

Sphinx version: 2.0.7
Thinking Sphinx gem version: 2.0.5
Rails version: 3.1.0.rc8
Ruby version: 1.9.2p290 

知道为什么会发生这种情况吗?

I have added the delta column to my table:

class AddDeltaIndexToCimgs < ActiveRecord::Migration
  def change
    add_column :cimgs, :delta, :boolean, default: true, null: false
  end
end

I migrated

I also added the define_index:

define_index do
  indexes search_cache
  has :approved
  set_property delta: true
end

And I ran the rake tasks

rake ts:stop
rake ts:index
rake ts:start

Or rake ts:rebuild

Then I add a new record to the table, search for it... and nothing.
The core-indexed records can be found perfectly, but the delta is not working at all.

To search them I use the following:

Cimg.search query, with: {approved: true}

And yes, every Cimg is approved, and have a bunch of stuff in search_cache, and the new ones are marked with delta=1 in the database. I double checked.

I checked the db/sphinx folder and a lot of files with the name cimg_delta are created.

Here is the generated configuration file: http://pastebin.com/z0fHr43k

Sphinx version: 2.0.7
Thinking Sphinx gem version: 2.0.5
Rails version: 3.1.0.rc8
Ruby version: 1.9.2p290 

Any idea of why this may be happening?

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

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

发布评论

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

评论(1

凉栀 2024-12-15 14:55:03

只是一个健全性检查,但在你的 config/sphinx.yml 文件中
你在做什么

    development:      
      min_prefix_len: 2  

      indexed_models:
        - Article
        - Match
        - Player
        - Team
        - Group
        - Tournament
        - Ground
        - User

确保你已经添加了任何新的索引模型,否则认为 sphinx 只会索引每个环境下指定的模型。我刚刚向用户模型添加了一个define_index,但无法弄清楚为什么在运行rake ts:rebuild时它没有被索引我忘记将indexed_models: user添加到shinx.yml

希望这有帮助,谢谢戴夫

Just a sanity check but in your config/sphinx.yml file
are you doing

    development:      
      min_prefix_len: 2  

      indexed_models:
        - Article
        - Match
        - Player
        - Team
        - Group
        - Tournament
        - Ground
        - User

Make sure you have added any new indexed models otherwise thinking sphinx will only index the ones specified under each environment. I just added a define_index to User model and couldn't figure out why it wasnt being indexed when running rake ts:rebuild I had forgotten to add the indexed_models: user to shinx.yml

Hope this is helpful, Thanks Dave

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