Using Rails 4, Thinking Sphinx 3.2.0. I recently renamed a column from for_search
to address_lookup
. The Shop
model has the column address_lookup
, and I have Country
which is associated to Shop
model.
Here's my Country
index:
ThinkingSphinx::Index.define :state, with: :real_time do
indexes name
indexes shop_address_lookup
...
end
I removed the development.sphinx.conf
, and ran ts:regenerate
. Indexing Shop
worked fine, but when it tried to index Country
, it kept throwing the following error:
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)
I only renamed the column, and already updated my index file. What can I do to fix this?
Note: When I rename the index from shop_address_lookup
to shop_for_search
again, without changing the actual column name, the index works fine.
Managed to get this to work finally - remove db/sphinx/development/*
before running rake ts:regenerate
.
Note to self:
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
........