4
我有我的Account
模型中定義的簡單思維獅身人面像指數:(忽略三角洲現在,我生成了完整的索引和搜索account_core
)爲什麼我的索引缺少Thinking Sphinx的文檔?
define_index do
indexes display_name
indexes email_addresses.email_address
has created_at
set_property :delta => :datetime, :threshold => 2.minutes
end
但我發現了一些意想不到的結果:
>> Account.count
# => 885138
>> Account.search.total_entries
# => 260795
>> Account.search("[email protected]")
# => []
然而,在命令行上,使用search
實用,我能找到倫尼:
$ search -c /etc/sphinx/water.sphinx.conf -i account_core [email protected]
index 'account_core': query '[email protected] ': returned 2 matches of 2 total in 0.759 sec
displaying matches:
1. document=3543432, weight=4, sphinx_internal_id=442101, sphinx_deleted=0, class_crc=0, created_at=Mon Apr 11 12:18:08 2011
2. document=5752816, weight=2, sphinx_internal_id=719552, sphinx_deleted=0, class_crc=0, created_at=Tue Dec 27 12:01:12 2011
確實這些都是德魯的賬戶ID。
爲什麼我在使用Thinking Sphinx進行搜索時無法找到Lenny?爲什麼total_entries
號碼比accounts
表中的總行數小得多?