On 7/10/06, Caspar <[EMAIL PROTECTED]> wrote:
> Hi okay thank you very much for replying, I'm very impressed with ferret
> and more impressed by you answering support questions, excellent work!
>
> anyway update
>
>
>
>
> wrong number of arguments (2 for 1)
>
> RAILS_ROOT: script/../config/..
> Application Trace | Framework Trace | Full Trace
> #{RAILS_ROOT}/app/models/vo_object.rb:26:in `initialize'
> #{RAILS_ROOT}/app/models/vo_object.rb:26:in `refine_search'
> #{RAILS_ROOT}/app/controllers/search_controller.rb:34:in `refine'
>
>
>
> line 26:
>
> bq.add_query(Ferret::Search::TermQuery.new(Ferret::Index::Term.new("section",search_input),
> Ferret::Search::BooleanClause::Occur::SHOULD))
Looks like you've got the brackets in the wrong place. I have to take
partial responsibility since didn't pick it up the first time either.
Try this;
bq.add_query(Ferret::Search::TermQuery.new(Ferret::Index::Term.new("section",search_input)),
Ferret::Search::BooleanClause::Occur::SHOULD)
> sorry I'm just rushing off for the commute home and have only just tried
> this, have not had enough time to play around with it yet so if its a
> stupid mistake by me i'm sorry for time wasting!
No worries. :D
> regards
> caspar
>
>
>
> David Balmain wrote:
> > On 7/10/06, Caspar <[EMAIL PROTECTED]> wrote:
> >> application. when i try the code at the bottom of this post i get the
> >> following errors (also in full at the bottom of post)
> >>
> >> NameError: uninitialized constant BooleanQuery
> >
> > Basically you just need to include the Search module in your code. ie.
> >
> > include Ferret::Search
> >
> > This could be dangerous so it is often better to include the full
> > class path as I demonstrate bellow.
> >
> >> caspar
> >> def VoObject.refine_search(search_input)
> >> bq = BooleanQuery.new
> >> bq.add_query(TermQuery.new(Term.new("section", search_input),
> >> BooleanClause::Occur::Should))
> >> filter = QueryFilter.new(bq)
> >> @vobjects = Item.find_by_contents(search_text,:filter => filter,
> >> :sort => ["section", "sale_category"])
> >> redirect_to :results
> >> end
> >>
> >
> > def VoObject.refine_search(search_input)
> > bq = Ferret::Search::BooleanQuery.new
> >
> > bq.add_query(Ferret::Search::TermQuery.new(Ferret::Index::Term.new("section",
> > search_input),
> > Ferret::Search::BooleanClause::Occur::Should))
> > filter = Ferret::Search::QueryFilter.new(bq)
> > @vobjects = Item.find_by_contents(search_text,:filter => filter,
> > :sort => ["section", "sale_category"])
> > redirect_to :results
> > end
> >
> > Please let me know if you are still having problems.
> >
> > Cheers,
> > Dave
>
>
> --
> Posted via http://www.ruby-forum.com/.
> _______________________________________________
> Ferret-talk mailing list
> [email protected]
> http://rubyforge.org/mailman/listinfo/ferret-talk
>
_______________________________________________
Ferret-talk mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/ferret-talk