undefined method delta

156 views
Skip to first unread message

spiceee

unread,
Mar 22, 2009, 1:09:10 AM3/22/09
to Thinking Sphinx

Hey, I have this config on my User model:

define_index do
indexes login, :sortable => true
indexes name, :sortable => true
set_property :delta => :datetime, :threshold => 1.day
set_property :enable_star => true
set_property :min_prefix_len => 3
set_property :morphology => false
end

Whenever I try to destroy a recent User I get

account#destroy (NoMethodError) "undefined method `delta' for #<User:
0x2b75095e14c0>"

I'm migrating from Ultrasphinx and not quite used to how TS handles
deltas yet. Do my user gets included in the delta index even if I
haven't run the delta indexing yet? (I'm running ts:index every 2
hours)

Thanks,

-Spe.

Pat Allan

unread,
Apr 10, 2009, 9:59:29 PM4/10/09
to thinkin...@googlegroups.com
Sorry for the delay in getting back to you. Turns out that was all my
fault, it was a bug in the code. I've just fixed it, so feel free to
get the latest from GitHub.

Cheers

--
Pat

Peter Akkies

unread,
May 24, 2009, 2:51:36 PM5/24/09
to Thinking Sphinx
I'm actually getting the same error now when I create a new Piece,
which is one of my models.

The error message reads:

undefined method `delta=' for #<Piece::Version:0x3c070e4>

The model's indexes are as follows:

define_index do
indexes title, subtitle, slug
has category_id, issue_id, kolumn_id, published_on, section_id
has authors(:id), :as => :author_ids
indexes section.slug, :as => :section
indexes category.title, :as => :category
indexes column.title, :as => :column
indexes [title, subtitle, teaser, body], :as => :body
indexes active_comments.body, :as => :comments
indexes authors.pen_name, :as => :author
indexes authors.affiliation, :as => :author_affiliation
indexes authorships.name, :as => :author_alias
set_property :delta => true

# Sorting for search results
has "4", :as => :custom_model_sort, :type => :integer
end

I'm running the latest Thinking Sphinx as of writing this, too. Any
ideas?

Pat Allan

unread,
May 24, 2009, 2:53:15 PM5/24/09
to thinkin...@googlegroups.com
Do you have a column called delta in your pieces table?

--
Pat

Peter Akkies

unread,
May 24, 2009, 3:21:39 PM5/24/09
to thinkin...@googlegroups.com
Yes, there's definitely a delta column there.

> --~--~---------~--~----~------------~-------~--~----~
> This message is part of the topic "undefined method delta" in the
> Google Group "Thinking Sphinx"
> for which you requested email updates.
> To stop receiving email updates for this topic, please visit the topic
> at http://groups.google.com/group/thinking-sphinx/t/4b81029295f0240d
> -~----------~----~----~----~------~----~------~--~---
>

--
With kind regards / Met vriendelijke groet,

Peter Akkies

Pat Allan

unread,
May 24, 2009, 3:35:36 PM5/24/09
to thinkin...@googlegroups.com
Ah, it seems you're using a versioning system? It's the Piece::Version
model that's complaining - perhaps try adding the delta column to that
as well?

--
Pat

Peter Akkies

unread,
May 24, 2009, 3:46:28 PM5/24/09
to Thinking Sphinx
Excellent, that fixed it, Pat!

It's funny because you wouldn't expect a versioning system to need
deltas if I'm not letting Sphinx index it--which I'm not, obviously,
since past versions will never change.

On May 24, 9:35 pm, Pat Allan <p...@freelancing-gods.com> wrote:
> Ah, it seems you're using a versioning system? It's the Piece::Version  
> model that's complaining - perhaps try adding thedeltacolumn to that  
> as well?
>
> --
> Pat
>
> On 24/05/2009, at 12:21 PM, Peter Akkies wrote:
>
>
>
> > Yes, there's definitely adeltacolumn there.
>
> > On May 24, 2009, at 8:53 PM, Pat Allan wrote:
>
> >> Do you have a column calleddeltain your pieces table?
>
> >> --  Pat
>
> >> On 24/05/2009, at 11:51 AM, Peter Akkies wrote:
>
> >>> I'm actually getting the same error now when I create a new Piece,
> >>> which is one of my models.
>
> >>> The error message reads:
>
> >>>undefinedmethod`delta=' for #<Piece::Version:0x3c070e4>
>
> >>> The model's indexes are as follows:
>
> >>> define_index do
> >>>  indexes title, subtitle, slug
> >>>  has category_id, issue_id, kolumn_id, published_on, section_id
> >>>  has authors(:id), :as => :author_ids
> >>>  indexes section.slug, :as => :section
> >>>  indexes category.title, :as => :category
> >>>  indexes column.title, :as => :column
> >>>  indexes [title, subtitle, teaser, body], :as => :body
> >>>  indexes active_comments.body, :as => :comments
> >>>  indexes authors.pen_name, :as => :author
> >>>  indexes authors.affiliation, :as => :author_affiliation
> >>>  indexes authorships.name, :as => :author_alias
> >>>  set_property :delta=> true
>
> >>>  # Sorting for search results
> >>>  has "4", :as => :custom_model_sort, :type => :integer
> >>> end
>
> >>> I'm running the latest Thinking Sphinx as of writing this, too. Any
> >>> ideas?
>
> >>> On Apr 11, 3:59 am, Pat Allan <p...@freelancing-gods.com> wrote:
> >>>> Sorry for the delay in getting back to you. Turns out that was  
> >>>> all my
> >>>> fault, it was a bug in the code. I've just fixed it, so feel free  
> >>>> to
> >>>> get the latest from GitHub.
>
> >>>> Cheers
>
> >>>> --
> >>>> Pat
>
> >>>> On 22/03/2009, at 4:09 PM, spiceee wrote:
>
> >>>>> Hey, I have this config on my User model:
>
> >>>>> define_index do
> >>>>>  indexes login, :sortable => true
> >>>>>  indexes name, :sortable => true
> >>>>>  set_property :delta=> :datetime, :threshold => 1.day
> >>>>>  set_property :enable_star => true
> >>>>>  set_property :min_prefix_len => 3
> >>>>>  set_property :morphology => false
> >>>>> end
>
> >>>>> Whenever I try to destroy a recent User I get
>
> >>>>> account#destroy (NoMethodError) "undefinedmethod`delta' for
> >>>>> #<User:
> >>>>> 0x2b75095e14c0>"
>
> >>>>> I'm migrating from Ultrasphinx and not quite used to how TS  
> >>>>> handles
> >>>>> deltas yet. Do my user gets included in thedeltaindex even if I
> >>>>> haven't run thedeltaindexing yet? (I'm running ts:index every 2

Pat Allan

unread,
May 24, 2009, 3:52:46 PM5/24/09
to thinkin...@googlegroups.com
Ah, an easy bug to fix :)

I think it's just the versioning system trying to make *all* the same
changes as the parent model. Is there a way to tell it to ignore
certain columns?

--
Pat

Peter Akkies

unread,
May 24, 2009, 4:02:13 PM5/24/09
to thinkin...@googlegroups.com
True, but thank you anyway :-)

The versioning system is actually acts_as_versioned and I don't know
whether it can ignore certain columns. For now though, I'm reluctant
to mess around with things now that they're actually working.

Also, I find your peepcode guide to TS very useful. Good job on that!

> --~--~---------~--~----~------------~-------~--~----~
> This message is part of the topic "undefined method delta" in the
> Google Group "Thinking Sphinx"
> for which you requested email updates.
> To stop receiving email updates for this topic, please visit the topic
> at http://groups.google.com/group/thinking-sphinx/t/4b81029295f0240d
> -~----------~----~----~----~------~----~------~--~---
>

--

Reply all
Reply to author
Forward
0 new messages