What happens if you change
   Container.search params[:search]
to
   ThinkingSphinx.search params[:search], :class => Container

Although ideally, the first version *should* work, but I've not seen  
this issue before.

-- 
Pat

On 03/09/2009, at 9:15 AM, T Nielson wrote:

> Hi Pat,
>
> I'm using the latest stable version of sphinx (0.9.8.1), Rails  
> 2.2.2, Ruby 1.8.6 and the latest version of TS I've found on 
> http://github.com/freelancing-god/thinking-sphinx/tree/master 
>  (clicked the Download Button). The searchcode is nearly the same  
> I've tried in the console:
>
> All this tried in development and on a local connection (localhost):
>
> Console:
> Container.search 'myvalue' --> returns an Array containing elements
>
> Controller:
> Container.search params[:search] --> returns 'undefined method  
> `search' for #<Class:0x10bc9944>' , I've already checked the  
> params[:search], so that's not the issue
>
> I could imagine that this is a PATH issue, but I'm not sure. My  
> sphinx.yml looks as below (development same as production and I  
> didn't set the bin_path in my system_environment path-variable, only  
> in the yml):
>
> production:
>   enable_star: 1
>   min_infix_len: 3
>   max_matches: 1000
>   bin_path: 'F:/Work/Aptana/sphinx/bin'
>   log: 'F:/Work/Aptana/sphinx/bin/log/searchd.log'
>   query_log: 'F:/Work/Aptana/sphinx/bin/log/query.log'
>
> Thank you very much for your help!
>
> Tom
>
> 2009/9/2 Pat Allan <[email protected]>
>
> Hi Tom
>
> Good to know we've got one issue out of the way.
>
> As for the next... what versions of TS, Rails and Sphinx are you
> using? And what is the search code in the controller that isn't
> working? Is there an error? Or just no results being returned?
>
> --
> Pat
>
> On 02/09/2009, at 9:43 PM, T Nielson wrote:
>
> > Hi Pat,
> >
> > I tried your proposal and it worked ;-) !! Thank you very much  -
> > but now I experience another problem: Model.search via ruby/script
> > console works... but Model.search from a controller doesn't. Maybe a
> > problem of a wrong thinking_sphinx version? Or do you have any clues
> > how this issue is caused?
> >
> > Best,
> > Tom
> >
> > 2009/9/2 Pat Allan <[email protected]>
> >
> > Hi Tom
> >
> > attris.value in your Container's define_index block should work. I
> > don't think value is a reserved word, but just in case, try the
> > following:
> >   indexes attris(:value), :as => :container_attribute
> >
> > --
> > Pat
> >
> > On 02/09/2009, at 7:09 PM, Tom wrote:
> >
> > >
> > > Hi Pat,
> > >
> > > thank you for your response. I tried two different ways because my
> > > models (Container and Attri) are in a 1:N association. I wanted  
> all
> > > container.attributes.values to be indexed but that didn't work, so
> > > I've tried the solution you can see in the Attri-Model below (and
> > that
> > > didn't work either..). All my other Models get indexed as they are
> > > supposed to be, so I thought about reserved keywords, in this
> > example
> > > "value". Here my models:
> > >
> > >
> > > class Attri < ActiveRecord::Base
> > >  belongs_to :container
> > >
> > >  define_index do
> > >    indexes :value, :as => :attri_value
> > >    set_property :delta => true
> > >  end
> > >
> > > end
> > >
> > >
> > > class Container < ActiveRecord::Base
> > >  has_many :attris, :dependent => :destroy
> > >
> > >  define_index do
> > >    indexes :name
> > >    indexes attris.value, :as => :container_attribute   #does this
> > > work? or should it be indexes container.attris.values, :as
> > > => :something ?
> > >    set_property :delta => true
> > >  end
> > >
> > > end
> > >
> > >
> > > Best regards,
> > > Tom
> > >
> > >
> > > On 2 Sep., 18:02, Pat Allan <[email protected]> wrote:
> > >> Hi Tom
> > >>
> > >> What's your define_index block looking like for this model? Are  
> you
> > >> seeing any error messages (and if not, what's indicating that  
> it's
> > >> not
> > >> working?)
> > >>
> > >> --
> > >> Pat
> > >>
> > >> On 01/09/2009, at 1:40 PM, Tom wrote:
> > >>
> > >>
> > >>
> > >>> hi there,
> > >>
> > >>> i'm trying to five models. the whole thing works.. except for  
> one
> > >>> model. it's name is "Attri" and has three values:  
> "container_id",
> > >>> "key_id" and .. the value i want to index: "value". is "value"
> > >>> maybe a
> > >>> reserved keyword and is not recognized by ts?
> > >>
> > >>> thanks in advance,
> > >>> tom
> > > >
> >
> >
> >
> >
> >
> > >
>
>
>
>
>
> >


--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to