Hi Chris
Your initial arguments to the define call are a little off. Try the following:
options = {with: :active_record, delta: false}
options[:delta] = ThinkingSphinx::Deltas::DelayedDelta if
Rails.env.production?
ThinkingSphinx::Index.define 'ideation/idea', options do
# everything you already had, except the set_property :delta … call
end
Cheers
--
Pat
On 12/07/2013, at 7:45 PM, Christopher Speer wrote:
> Hey,
>
> I just upgraded from TS 2.x (latest) to 3.0.4 and I keep getting this error
> when I hit the search in one of my controllers:
> undefined method `options' for nil:NilClass
>
> The trace says it's in:
> thinking-sphinx (3.0.4) lib/thinking_sphinx/middlewares/sphinxql.rb:114:in
> `index_options'
> thinking-sphinx (3.0.4) lib/thinking_sphinx/middlewares/sphinxql.rb:133:in
> `block in select_options'
> thinking-sphinx (3.0.4) lib/thinking_sphinx/middlewares/sphinxql.rb:131:in
> `each'
> thinking-sphinx (3.0.4) lib/thinking_sphinx/middlewares/sphinxql.rb:131:in
> `inject'
> thinking-sphinx (3.0.4) lib/thinking_sphinx/middlewares/sphinxql.rb:131:in
> `select_options'
> thinking-sphinx (3.0.4) lib/thinking_sphinx/middlewares/sphinxql.rb:227:in
> `method_missing'
> thinking-sphinx (3.0.4) lib/thinking_sphinx/middlewares/sphinxql.rb:223:in
> `scope_by_options'
> thinking-sphinx (3.0.4) lib/thinking_sphinx/middlewares/sphinxql.rb:177:in
> `filter_by_scopes'
> thinking-sphinx (3.0.4) lib/thinking_sphinx/middlewares/sphinxql.rb:158:in
> `to_riddle_query_select'
> thinking-sphinx (3.0.4) lib/thinking_sphinx/middlewares/sphinxql.rb:148:in
> `statement'
> thinking-sphinx (3.0.4) lib/thinking_sphinx/middlewares/sphinxql.rb:25:in
> `call'
> thinking-sphinx (3.0.4) lib/thinking_sphinx/middlewares/sphinxql.rb:10:in
> `block in call'
> thinking-sphinx (3.0.4) lib/thinking_sphinx/middlewares/sphinxql.rb:9:in
> `each'
> thinking-sphinx (3.0.4) lib/thinking_sphinx/middlewares/sphinxql.rb:9:in
> `call'
> thinking-sphinx (3.0.4)
> lib/thinking_sphinx/middlewares/stale_id_filter.rb:10:in `call'
>
>
> One of my Index definitions this is happening to looks like this:
>
> ThinkingSphinx::Index.define 'Ideation::Idea', { name: 'ideation_idea', with:
> :active_record } do
> indexes :title
> indexes :body
> indexes comments.body, as: :comment_body
> has :customer_id
> has :category_id
> has :created_at
> has :deleted
> set_property delta: (::Rails.env.production? ?
> ThinkingSphinx::Deltas::DelayedDelta : true)
> set_property field_weights: { title: 4, body: 4, comment_body: 2 }
> end
>
> The line in lib/thinking_sphinx/middlewares/sphinxql.rb:114 is:
> indices.first.options
>
> Basically indices returns an instance of ThinkingSphinx::IndexSet which
> doesn't properly respond to the "first" method.
> Any ideas?
>
> Thanks
> Chris
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Thinking Sphinx" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/thinking-sphinx.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
--
You received this message because you are subscribed to the Google Groups
"Thinking Sphinx" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/thinking-sphinx.
For more options, visit https://groups.google.com/groups/opt_out.