Ok, a little more research. I placed a "puts" in the ThinkingSphinx
\builder.rb no_fields? method...
def no_fields?
puts @index.inspect
@index.sources.empty? || @index.sources.any? { |source|
source.fields.length == 0
}
end
This is where the error is coming from, so here's the output of my
puts statement...
#<ThinkingSphinx::Index:0x10571d850 @name="chat", @delta_object=nil,
@options={}, @sources=[], @model=Chat(id: integer, subject: string,
social_profile_id: integer, created_at: datetime, updated_at:
datetime, category: string, profile_key: string)>
You can see the @model(subject:string) field exists, but the @sources
is empty. What is the @sources for and what can I do differently to
populate this info?
Thanks!
Chris
On Sep 20, 5:07 pm, internetchris <[email protected]> wrote:
> Just an FYI...
>
> I created a config/sphinx.yml file and put the following in it..
>
> development:
> indexed_models:
> - Chat
>
> This didn't seem to help. I'm sure it's something simple, but I can't
> seem to put my finger on it. According to another post I read it
> mentioned a similar error when placing the "define_index" prior to the
> has_many/belongs_to statements. In my case, I have it listed after the
> relationships are defined so that shouldn't be a problem.
>
> Chris
>
> On Sep 20, 4:59 pm, internetchris <[email protected]> wrote:
>
>
>
>
>
>
>
> > Hi Pat,
>
> > I tried that with the same result. I did a search on "define_index" in
> > my app with the thought maybe it was used by a plugin or something but
> > the only thing I found was my model definition and the TS stuff in the
> > plugins directory. I noticed some posts on a "config/sphinx.yml"
> > file....which I don't have. If I wanted to define my model in this
> > file, what would the appropriate syntax be. I saw a post by someone
> > that did this with their staging environment and it fixed the
> > problem.
>
> > Thanks!
>
> > Chris
>
> > On Sep 20, 4:41 pm, Pat Allan <[email protected]> wrote:
>
> > > Hi Chris
>
> > > This shouldn't be any different, but can you try subject as a symbol
> > > instead:
>
> > > define_index do
> > > indexes :subject
> > > end
>
> > > Just in case some other library's inserting a subject method into the
> > > global scope.
>
> > > --
> > > Pat
>
> > > On 21/09/2011, at 4:42 AM, internetchris wrote:
>
> > > > Hi Group,
>
> > > > I'm trying to implement TS in my Rails 2.3.5 app. I watched the
> > > > screencast and hoped it would be pretty straight forward. I have a
> > > > "Chat" model and in the model I defined a single index..
>
> > > > define_index do
> > > > indexes subject
> > > > end
>
> > > > when I run rake ts:index I get the following error.
>
> > > > Generating Configuration to /Users/Chris/rails/myapp/config/
> > > > development.sphinx.conf
> > > > rake aborted!
> > > > At least one field is necessary for an index
>
> > > > I even tried passing the rails environment to the rake task but
> > > > without luck. This field indeed exists in my DB. For the heck of it I
> > > > also tried it on another model using the "first_name" field of my User
> > > > model and go the same error.
>
> > > > Environment:
>
> > > > Rails 2.3.5
> > > > Thinking Sphinx v1.4.7
> > > > Mysql db
>
> > > > Any suggestions would be happily appreciated.
>
> > > > Thanks!
>
> > > > Chris
>
> > > > --
> > > > You received this message because you are subscribed to the Google
> > > > Groups "Thinking Sphinx" group.
> > > > To post to this group, send email to [email protected].
> > > > To unsubscribe from this group, send email to
> > > > [email protected].
> > > > For more options, visit this group
> > > > athttp://groups.google.com/group/thinking-sphinx?hl=en.
--
You received this message because you are subscribed to the Google Groups
"Thinking Sphinx" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/thinking-sphinx?hl=en.