开发者

Thinking Sphinx Delta Index not working

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?


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜