使用Rails 4,思考Sphinx 3.2.0。我最近将一个列从cat Security.txt | sed -n "/Account/,/Recognized/pI" | sed -e '1d' -e '$d'
sed: -e expression #1, char 24: extra characters after command
重命名为for_search
。 address_lookup
模型的列为Shop
,我address_lookup
与Country
模型相关联。
这是我的Shop
索引:
Country
我删除了ThinkingSphinx::Index.define :state, with: :real_time do
indexes name
indexes shop_address_lookup
...
end
,然后运行了development.sphinx.conf
。索引ts:regenerate
工作正常,但当它尝试索引Shop
时,它仍然抛出以下错误:
Country
我只重命名了这个列,并且已经更新了我的索引文件。我该怎么做才能解决这个问题?
注意:当我再次将索引从Generating index files for country_core
rake aborted!
ThinkingSphinx::SphinxError: unknown column: 'shop_address_lookup' - REPLACE INTO country_core (id, `sphinx_internal_class_name`, `name`, `country_status`, `shop_address_lookup`
...
/Users/abc/.rbenv/versions/2.3.1/bin/bundle:23:in `load'
/Users/abc/.rbenv/versions/2.3.1/bin/bundle:23:in `<main>'
Innertube::Pool::BadResource: Innertube::Pool::BadResource
/Users/abc/.rbenv/versions/2.3.1/bin/bundle:23:in `load'
/Users/abc/.rbenv/versions/2.3.1/bin/bundle:23:in `<main>'
ThinkingSphinx::QueryExecutionError: unknown column: 'shop_address_lookup'
...
/Users/abc/.rbenv/versions/2.3.1/bin/bundle:23:in `load'
/Users/abc/.rbenv/versions/2.3.1/bin/bundle:23:in `<main>'
Mysql2::Error: unknown column: 'shop_address_lookup'
/Users/abc/.rbenv/versions/2.3.1/bin/bundle:23:in `load'
/Users/abc/.rbenv/versions/2.3.1/bin/bundle:23:in `<main>'
Tasks: TOP => ts:regenerate => ts:generate
(See full trace by running task with --trace)
重命名为shop_address_lookup
时,如果不更改实际的列名,索引就可以正常工作。
答案 0 :(得分:0)
管理以使其最终发挥作用 - 在运行db/sphinx/development/*
之前删除rake ts:regenerate
。
自我注意:
abc@Vmac-2 ~/Sites/xyz (master●●)$ rake ts:regenerate
Stopped searchd daemon (pid: 65211).
Generating configuration to /Users/abc/Sites/xyz/config/development.sphinx.conf
Failed to start searchd daemon. Check /Users/abc/Sites/xyz/log/development.searchd.log.
Failed to start searchd. Check the log files for more information.
Generating index files for spot_core
^C% abc@Vmac-2 ~/Sites/xyz (master●●)$ ps aux | grep searcd
abc 65649 0.0 0.0 2423380 300 s001 R+ 2:10AM 0:00.00 grep --color=auto searcd
abc@Vmac-2 ~/Sites/xyz (master●●)$ ps aux | grep searchd
abc 65727 0.0 0.0 2435864 788 s001 R+ 2:10AM 0:00.00 grep --color=auto searchd
========== REMOVE db/sphinx/development/* at this step ============
abc@Vmac-2 ~/Sites/xyz (master●●)$ rake ts:regenerate
searchd is not currently running.
Stopped searchd daemon (pid: ).
Generating configuration to /Users/abc/Sites/xyz/config/development.sphinx.conf
Started searchd successfully (pid: 65936).
Generating index files for shop_core
..........................
Generating index files for trip_core
........