Rake error: At least one field is necessary for an index
Update: I downgraded thinking_sphinx to 1.4.9... Then I get this error when I run the rake tasks:
rake aborted!
undefined method `indexes' for
#<Riddle::Configuration:0x103496d90>
So I downgraded riddle to 1.4.0 but then there is a conflict with flying sphinx requiring 1.5.0.
So I downgraded flying sphinx to 0.6.0 but then there is a conflict with farady. Omniauth wants > 0.7.3 and flying sphinx wants 0.6.1...
Arg, this is getting really frustrating. Why does it feel like I am building a house of cards..?
Comments are currently closed for this discussion. You can start a new one.
Support Staff 2 Posted by Pat Allan on 01 Dec, 2011 02:20 AM
If you grab flying-sphinx 0.6.1, riddle 1.5.0 and TS 1.4.10, then you should be fine. If I'm wrong, let me know, but I've used that combination myself.
I know it's a little frustrating - I changed a method in Riddle, but there's no easy way to specify TS dependencies for FS, because it works with 2.x and 1.x.
3 Posted by Barry paul on 01 Dec, 2011 04:35 PM
That combo gives me a conflict with omniauth on faraday:
Bundler could not find compatible versions for gem "faraday":
In Gemfile:
omniauth (~> 0.3.2) ruby depends on
faraday (~> 0.7.3) ruby
flying-sphinx (= 0.6.0) ruby depends on
faraday (0.6.1)
From my Gemfile:
# sphinx
gem 'riddle', '1.5.0'
gem 'thinking-sphinx', '1.4.10'
gem 'flying-sphinx', '0.6.0'
# omniauth
gem 'omniauth', '~> 0.3.2'
I really need to get this sorted out ASAP, thanks!
--
Barry
Support Staff 4 Posted by Pat Allan on 02 Dec, 2011 01:15 AM
Almost right - try flying-sphinx 0.6.1 instead of 0.6.0, that should be friendlier when it comes to faraday requirements.
5 Posted by Barry paul on 02 Dec, 2011 01:39 AM
Sorry I did try that and it installs the gems but I'm back to the
original Rake error:
** Invoke fs:index (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute fs:index
Starting Index Request
rake aborted!
At least one field is necessary for an index
/opt/local/lib/ruby/gems/1.8/gems/thinking-sphinx-1.4.10/lib/thinking_sphinx/index/builder.rb:35:in
`initialize'
/opt/local/lib/ruby/gems/1.8/gems/thinking-sphinx-1.4.10/lib/thinking_sphinx/index/builder.rb:22:in
`new'
/opt/local/lib/ruby/gems/1.8/gems/thinking-sphinx-1.4.10/lib/thinking_sphinx/index/builder.rb:22:in
`generate'
/opt/local/lib/ruby/gems/1.8/gems/thinking-sphinx-1.4.10/lib/thinking_sphinx/active_record.rb:208:in
`add_sphinx_index'
/opt/local/lib/ruby/gems/1.8/gems/thinking-sphinx-1.4.10/lib/thinking_sphinx/active_record.rb:175:in
`define_index'
/opt/local/lib/ruby/gems/1.8/gems/thinking-sphinx-1.4.10/lib/thinking_sphinx/active_record.rb:190:in
`call'
/opt/local/lib/ruby/gems/1.8/gems/thinking-sphinx-1.4.10/lib/thinking_sphinx/active_record.rb:190:in
`define_indexes'
/opt/local/lib/ruby/gems/1.8/gems/thinking-sphinx-1.4.10/lib/thinking_sphinx/active_record.rb:189:in
`each'
/opt/local/lib/ruby/gems/1.8/gems/thinking-sphinx-1.4.10/lib/thinking_sphinx/active_record.rb:189:in
`define_indexes'
/opt/local/lib/ruby/gems/1.8/gems/thinking-sphinx-1.4.10/lib/thinking_sphinx/configuration.rb:159:in
`generate'
/opt/local/lib/ruby/gems/1.8/gems/thinking-sphinx-1.4.10/lib/thinking_sphinx/configuration.rb:157:in
`each'
/opt/local/lib/ruby/gems/1.8/gems/thinking-sphinx-1.4.10/lib/thinking_sphinx/configuration.rb:157:in
`generate'
/opt/local/lib/ruby/gems/1.8/gems/flying-sphinx-0.6.1/lib/flying_sphinx/configuration.rb:21:in
`sphinx_configuration'
/opt/local/lib/ruby/gems/1.8/gems/flying-sphinx-0.6.1/lib/flying_sphinx/index_request.rb:70:in
`update_sphinx_configuration'
/opt/local/lib/ruby/gems/1.8/gems/flying-sphinx-0.6.1/lib/flying_sphinx/index_request.rb:32:in
`update_and_index'
/opt/local/lib/ruby/gems/1.8/gems/flying-sphinx-0.6.1/lib/flying_sphinx/tasks.rb:6
/opt/local/lib/ruby/gems/1.8/gems/rake-0.9.2.2/lib/rake/task.rb:205:in
`call'
/opt/local/lib/ruby/gems/1.8/gems/rake-0.9.2.2/lib/rake/task.rb:205:in
`execute'
/opt/local/lib/ruby/gems/1.8/gems/rake-0.9.2.2/lib/rake/task.rb:200:in
`each'
/opt/local/lib/ruby/gems/1.8/gems/rake-0.9.2.2/lib/rake/task.rb:200:in
`execute'
/opt/local/lib/ruby/gems/1.8/gems/rake-0.9.2.2/lib/rake/task.rb:158:in
`invoke_with_call_chain'
/opt/local/lib/ruby/1.8/monitor.rb:242:in `synchronize'
/opt/local/lib/ruby/gems/1.8/gems/rake-0.9.2.2/lib/rake/task.rb:151:in
`invoke_with_call_chain'
/opt/local/lib/ruby/gems/1.8/gems/rake-0.9.2.2/lib/rake/task.rb:144:in
`invoke'
/opt/local/lib/ruby/gems/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:116:in
`invoke_task'
/opt/local/lib/ruby/gems/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:94:in
`top_level'
/opt/local/lib/ruby/gems/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:94:in
`each'
/opt/local/lib/ruby/gems/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:94:in
`top_level'
/opt/local/lib/ruby/gems/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:133:in
`standard_exception_handling'
/opt/local/lib/ruby/gems/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:88:in
`top_level'
/opt/local/lib/ruby/gems/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:66:in
`run'
/opt/local/lib/ruby/gems/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:133:in
`standard_exception_handling'
/opt/local/lib/ruby/gems/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:63:in
`run'
/opt/local/lib/ruby/gems/1.8/gems/rake-0.9.2.2/bin/rake:33
/opt/local/bin/rake:19:in `load'
/opt/local/bin/rake:19
Support Staff 6 Posted by Pat Allan on 02 Dec, 2011 01:44 AM
Right - what does your define_index block look like? And does it all work fine locally with Thinking Sphinx?
7 Posted by Barry paul on 02 Dec, 2011 01:49 AM
No, same error for ts:index
I have had thinking sphinx working with this app before on another
server. My define_index is:
# thinking sphinx indexes
define_index do
# fields
indexes content, :morphology => :stem_en
# attributes
has rank, popularity, open140_question_id
has "ISNULL(equivalent_id)", :as => :is_primary, :type => :integer
set_property :delta => true
end
Thanks for the help,
--
Barry
Support Staff 8 Posted by Pat Allan on 02 Dec, 2011 01:54 AM
All looks fine - although `:morphology' option can't be applied on a per-field basis, so that'll have no impact.
What version of Rails are you using? And are you using Bundler to manage dependencies? Or config/environment.rb and .gems?
9 Posted by Barry paul on 02 Dec, 2011 02:04 AM
Rails 2.3.11 with bundler. Here is my Gemfile:
source :gemcutter
gem "rails", "2.3.11"
gem "mysql"
#inline attachment for emails
gem 'inline_attachment'
#prawn for pdf generation
gem 'prawn'
# remit for Amazon FPS
gem 'remit', '~> 0.0.1'
# hoptoad
gem 'hoptoad_notifier'
# sphinx
gem 'riddle', '1.5.0'
gem 'thinking-sphinx', '1.4.10'
gem 'flying-sphinx', '0.6.1'
# email validation
gem 'validates_email_format_of'
# twilio for sms and voice commnuication
gem 'trails'
# auth logic
gem 'authlogic', '~> 2.1.6'
# omniauth
gem 'omniauth', '~> 0.3.2'
gem "tlsmail"
gem "haml"
gem "ziya"
gem "RedCloth"
gem "hpricot"
gem "rmagick"
gem 'prawn'
gem "inline_attachment"
gem "hoptoad_notifier"
gem "rufus-mnemo"
gem "trails"
gem "thin"
gem "aws-s3"
gem "pusher"
gem "twitter"
gem "jammit", :git => "git://github.com/documentcloud/jammit.git"
group :development do
gem 'yui-compressor', :git =>
"git://github.com/sstephenson/ruby-yui-compressor.git", :require =>
"yui/compressor"
gem 'closure-compiler'
gem 'uglifier'
end
Support Staff 10 Posted by Pat Allan on 02 Dec, 2011 02:07 AM
Can you try switching TS to a git reference instead?
I had someone recently getting the same issue as you, and it was because of the vendored version of BlankSlate in Rails (though he was using a much older version of Rails, so I'm not yet convinced it's the same problem we're facing). I've just removed the BlankSlate reference from TS 1.x, just haven't released a new version with that change.
11 Posted by Barry paul on 02 Dec, 2011 02:15 AM
That worked!
At least locally, I'll deploy and try flying sphinx
Thanks,
--
BP
On 12/1/11 6:07 PM, Pat Allan wrote:
> gem 'thinking-sphinx',
> :git => 'git://github.com/freelancing-god/thinking-sphinx.git',
> :ref => 'e87898bd0f2eebb07cef79698f835c85bcbafc3a'
--
--
BP
12 Posted by Barry paul on 02 Dec, 2011 02:23 AM
Arg, I get an error when trying to deploy to Heroku. When bundler runs I
get:
Using thinking-sphinx (1.4.10) from
git://github.com/freelancing-god/thinking-sphinx.git (at e87898b)
Installing flying-sphinx (0.6.1)
Installing haml (3.1.4)
Installing hoe (2.12.4)
/usr/ruby1.8.7/lib/ruby/site_ruby/1.8/rubygems/installer.rb:170:in
`install': hoe requires RubyGems version >= 1.4. Try 'gem update
--system' to update RubyGems itself. (Gem::InstallError)
from
/usr/ruby1.8.7/lib/ruby/gems/1.8/gems/bundler-1.0.7/lib/bundler/source.rb:95:in
`install'
from
/usr/ruby1.8.7/lib/ruby/gems/1.8/gems/bundler-1.0.7/lib/bundler/installer.rb:55:in
`run'
from
/usr/ruby1.8.7/lib/ruby/gems/1.8/gems/bundler-1.0.7/lib/bundler/spec_set.rb:12:in
`each'
from
/usr/ruby1.8.7/lib/ruby/gems/1.8/gems/bundler-1.0.7/lib/bundler/spec_set.rb:12:in
`each'
from
/usr/ruby1.8.7/lib/ruby/gems/1.8/gems/bundler-1.0.7/lib/bundler/installer.rb:44:in
`run'
from
/usr/ruby1.8.7/lib/ruby/gems/1.8/gems/bundler-1.0.7/lib/bundler/installer.rb:8:in
`install'
from
/usr/ruby1.8.7/lib/ruby/gems/1.8/gems/bundler-1.0.7/lib/bundler/cli.rb:225:in
`install'
from
/usr/ruby1.8.7/lib/ruby/gems/1.8/gems/bundler-1.0.7/lib/bundler/vendor/thor/task.rb:22:in
`send'
from
/usr/ruby1.8.7/lib/ruby/gems/1.8/gems/bundler-1.0.7/lib/bundler/vendor/thor/task.rb:22:in
`run'
from
/usr/ruby1.8.7/lib/ruby/gems/1.8/gems/bundler-1.0.7/lib/bundler/vendor/thor/invocation.rb:118:in
`invoke_task'
from
/usr/ruby1.8.7/lib/ruby/gems/1.8/gems/bundler-1.0.7/lib/bundler/vendor/thor.rb:246:in
`dispatch'
from
/usr/ruby1.8.7/lib/ruby/gems/1.8/gems/bundler-1.0.7/lib/bundler/vendor/thor/base.rb:389:in
`start'
from
/usr/ruby1.8.7/lib/ruby/gems/1.8/gems/bundler-1.0.7/bin/bundle:13
from /usr/ruby1.8.7/bin/bundle:19:in `load'
from /usr/ruby1.8.7/bin/bundle:19
FAILED: http://devcenter.heroku.com/articles/bundler
! Heroku push rejected, failed to install gems via Bundler
I'll try to add an older version of hoe and see if that fixes it...
--
BP
13 Posted by Barry on 02 Dec, 2011 02:37 AM
That worked! I just added the following hoe dependecy in my Gem file above thinking/flying sphinx:
gem 'hoe', '2.5.0'
Thanks for the help, should I keep the git ref in my gem file?
-- Barry
Support Staff 14 Posted by Pat Allan on 02 Dec, 2011 02:44 AM
Great to hear. Not sure what's bringing in the hoe reference - it's certainly none of my code. Gemfile.lock will have that information.
But yes, best to stick to the git reference, at least until there's another gem release. Locking to the specific commit reference will keep things stable as well.
15 Posted by Barry paul on 02 Dec, 2011 03:01 AM
FYI. Hoe is definitely coming in with flying sphinx (maybe a dependency
of a dependency?). To verify I just removed flying_sphinx (and the hoe
reference) from my Gemfile and there is no hoe in my Gemfile.lock. When
I add fs back to the Gemfile it reappears and is referenced by 'mash' if
that is any help...
--
BP
Support Staff 16 Posted by Pat Allan on 02 Dec, 2011 03:10 AM
Interesting. Thanks for the clarification.
17 Posted by Joe Sak on 12 Dec, 2011 12:41 AM
I ran into this same issue but cannot install your commit sha due to my app being rails 3.1.3 it says:
Bundler could not find compatible versions for gem "activerecord":
In snapshot (Gemfile.lock):
In Gemfile:
Running
bundle updatewill rebuild your snapshot from scratch, using onlythe gems in your Gemfile, which may resolve the conflict.
[production][~/code/planet-documentary] bundle update Updating git://github.com/freelancing-god/thinking-sphinx.git
Updating git://github.com/mbleigh/acts-as-taggable-on.git
Fetching source index for http://rubygems.org/
Bundler could not find compatible versions for gem "activerecord":
In Gemfile:
But I also have the error about indexes on Riddle in production (but not development)
Support Staff 18 Posted by Pat Allan on 12 Dec, 2011 12:47 AM
Hi Joe
What does your reference for
thinking-sphinxlook like in your Gemfile?19 Posted by Joe Sak on 12 Dec, 2011 12:50 AM
Weird
Now I see this in the log
using config file '/mnt/sphinx/flying-sphinx/d5b836d6d3c11a2f4/sphinx.conf'...
indexing index 'documentary_core'...
ERROR: index 'documentary_core': sql_range_query: ERROR: syntax error at or near ","
LINE 1: ...entaries"."title", "documentaries"."description", , , "docum...
(DSN=pgsql://hzciydhmkw:***@127.0.0.1:10314/hzciydhmkw). total 0 docs, 0 bytes
total 0.121 sec, 0 bytes/sec, 0.00 docs/sec
skipping non-plain index 'documentary'...
total 0 reads, 0.000 sec, 0.0 kb/call avg, 0.0 msec/call avg
total 0 writes, 0.000 sec, 0.0 kb/call avg, 0.0 msec/call avg
From the index logs
It worked in development (ts:index) ... fs:index gave memory allocation error but seemed to run fine in production:
[production][~/code/planet-documentary] heroku run rake cron Running rake cron attached to terminal... up, run.7
Starting Index Request
Index Request has completed.
20 Posted by Joe Sak on 12 Dec, 2011 12:55 AM
This is my only configured model:
define_index do
end
tag_list is a method given by ActsAsTaggableOn
category_title is a delegated attribute on the category association
Support Staff 21 Posted by Pat Allan on 12 Dec, 2011 12:59 AM
You can only have columns (and columns via associations) in your index definitions - Sphinx talks to your database directly, not through Ruby/Rails, so you'll want to try something like this instead:
22 Posted by Joseph M Sak on 12 Dec, 2011 01:08 AM
That did it!
Man how awesome that I got such fast support on a Sunday night.
Thanks!
23 Posted by Joseph M Sak on 12 Dec, 2011 01:11 AM
I don't know if you can help me with my connection error at all, I've submitted a ticket with Heroku Support but the error is this
Error Message:
Riddle::ConnectionError: Connection to ec2-184-73-20-134.compute-1.amazonaws.com on 9314 failed. Connection refused - connect(2)
Where:
search#new
[PROJECT_ROOT]/vendor/bundle/ruby/1.9.1/gems/riddle-1.5.0/lib/riddle/client.rb, line 575
URL:
http://www.planetdocumentary.com/search?utf8=%E2%9C%93&query=cosmos
Support Staff 24 Posted by Pat Allan on 12 Dec, 2011 01:14 AM
Hah, well it is just after midday on Monday afternoon here :)
As for that error, have you started the daemon now that indexing is working?
heroku run rake fs:start25 Posted by Joseph M Sak on 12 Dec, 2011 01:15 AM
Yep! That was it! Whups! Sorry… I assumed it would happen as either part of the add-on installation or in heroku's deploy hooks (kind of like new relic)
26 Posted by Joe Sak on 12 Dec, 2011 01:17 AM
So yeah I would update the docs:
gem 'thinking-sphinx', '2.0.10'
gem 'flying-sphinx', '0.6.1'
and
heroku run rake fs:start (for heroku addon docs, which seem to be a copy of your main docs) (run is for cedar)
Thanks!!
Pat Allan closed this discussion on 17 Dec, 2011 04:28 AM.