Hi Jochen
Are you absolutely certain you're not defining a search_filters method anywhere
else in your project? Perhaps in the ApplicationController? Also: are you able
to share your products_controller.rb, perhaps in a gist? It makes it easier to
compare with the stack trace.
Thanks
--
Pat
On 22/10/2010, at 10:05 AM, Jochen Kaechelin wrote:
>
> Am 20.10.2010 um 00:56 schrieb Pat Allan:
>
>> Hi Jochen
>>
>> What's the full stack trace, and what does your define_index block look
>> like? Also: what versions of thinking sphinx are you using locally and
>> production? It's worth double-checking the gems:
>>
>
> define_index do
> indexes product, :sortable => true, :unique => true
> indexes order_number, :sortable => true, :unique => true
> indexes brand_order_number, :sortable => true, :unique => true
> indexes description
> indexes brand, :sortable => true, :facet => true
> indexes boost, :sortable => true
> indexes category_boost, :sortable => true, :facet => true
> indexes sales_weight, :sortable => true
> indexes product_translations(:trans_description), :as => :translation
>
> indexes tags.name, :as => :tags, :facet => true
>
> indexes unit
>
> has taggings(:tag_id), :as => :taggings_ids
> has categories(:id), :as => :category_ids
> has colors(:id), :as => :color_ids, :facet => true
>
> has inventory
> has at_stock
> has price1
> has rank
> has created_at
> has sales_rank
> has selling_off
> has offline
> has sold_out
> has has_special_price
> has active
> has only_order
> has recommended
>
> set_property :delta => :delayed
> end
>
> --------------
>
> @products = Product.search "",
> :match_mode => :extended2,
> :page => params[:page],
> :per_page => 21,
> :max_matches => SPHINXMAXMATCHES,
> :with => search_filters("newin_assortment"),
> :order => order_filters("newin_assortment")
>
> ----------------
>
> def order_filters(flag="")
> if flag == "newin_assortment"
> defaults[:order] = "created_at DESC,at_stock DESC"
> end
> defaults
> end
>
> ----------------
>
> def search_filters(flag)
> defaults = { :active => 1 }
> if flag.include? "newin_assortment"
> defaults[:created_at] = 30.days.ago..Time.now
> end
> defaults
> end
>
> ----------------
>
> ArgumentError (wrong number of arguments (1 for 0)):
> app/controllers/products_controller.rb:60:in `search_filters'
> app/controllers/products_controller.rb:60:in `newin_assortment'
> passenger (3.0.0) lib/phusion_passenger/rack/request_handler.rb:96:in
> `process_request'
> passenger (3.0.0) lib/phusion_passenger/abstract_request_handler.rb:513:in
> `accept_and_process_next_request'
> passenger (3.0.0) lib/phusion_passenger/abstract_request_handler.rb:274:in
> `main_loop'
> passenger (3.0.0)
> lib/phusion_passenger/classic_rails/application_spawner.rb:321:in
> `start_request_handler'
> passenger (3.0.0)
> lib/phusion_passenger/classic_rails/application_spawner.rb:275:in `send'
> passenger (3.0.0)
> lib/phusion_passenger/classic_rails/application_spawner.rb:275:in
> `handle_spawn_application'
> passenger (3.0.0) lib/phusion_passenger/utils.rb:479:in `safe_fork'
> passenger (3.0.0)
> lib/phusion_passenger/classic_rails/application_spawner.rb:270:in
> `handle_spawn_application'
> passenger (3.0.0) lib/phusion_passenger/abstract_server.rb:357:in `__send__'
> passenger (3.0.0) lib/phusion_passenger/abstract_server.rb:357:in
> `server_main_loop'
> passenger (3.0.0) lib/phusion_passenger/abstract_server.rb:206:in
> `start_synchronously'
> passenger (3.0.0) lib/phusion_passenger/abstract_server.rb:180:in `start'
> passenger (3.0.0)
> lib/phusion_passenger/classic_rails/application_spawner.rb:149:in `start'
> passenger (3.0.0) lib/phusion_passenger/spawn_manager.rb:219:in
> `spawn_rails_application'
> passenger (3.0.0) lib/phusion_passenger/abstract_server_collection.rb:132:in
> `lookup_or_add'
> passenger (3.0.0) lib/phusion_passenger/spawn_manager.rb:214:in
> `spawn_rails_application'
> passenger (3.0.0) lib/phusion_passenger/abstract_server_collection.rb:82:in
> `synchronize'
> passenger (3.0.0) lib/phusion_passenger/abstract_server_collection.rb:79:in
> `synchronize'
> passenger (3.0.0) lib/phusion_passenger/spawn_manager.rb:213:in
> `spawn_rails_application'
> passenger (3.0.0) lib/phusion_passenger/spawn_manager.rb:132:in
> `spawn_application'
> passenger (3.0.0) lib/phusion_passenger/spawn_manager.rb:275:in
> `handle_spawn_application'
> passenger (3.0.0) lib/phusion_passenger/abstract_server.rb:357:in `__send__'
> passenger (3.0.0) lib/phusion_passenger/abstract_server.rb:357:in
> `server_main_loop'
> passenger (3.0.0) lib/phusion_passenger/abstract_server.rb:206:in
> `start_synchronously'
> passenger (3.0.0) helper-scripts/passenger-spawn-server:99
>
>
>> gem list | grep thinking-sphinx
>>
>
> passenger (3.0.0)
> polyglot (0.3.1)
> pony (1.0.1)
> rack (1.2.1, 1.1.0)
> rails (2.3.10)
> rake (0.8.7)
> RedCloth (4.2.3)
> riddle (1.1.0)
> spruz (0.1.5)
> thinking-sphinx (1.3.20)
> treetop (1.4.8)
> ts-delayed-delta (1.1.1)
> whenever (0.6.1, 0.5.3)
> will_paginate (2.3.15)
>
>
>
>
>
>> Cheers
>>
>> --
>> Pat
>>
>> On 19/10/2010, at 5:46 PM, Jochen Kaechelin wrote:
>>
>>> Seems to be one of those days nothing will work:
>>>
>>> I have this:
>>>
>>> @products = Product.search @query,
>>> :with => {:active => 1},
>>> :match_mode => :extended2,
>>> :page => params[:page],
>>> :star => true,
>>> :per_page => 21,
>>> :max_matches => SPHINXMAXMATCHES,
>>> :conditions => search_filters(params[:searchfilter]), **** <--- line 281
>>> :order => "at_stock DESC, has_special_price DESC, sales_rank DESC,
>>> inventory DESC",
>>> :field_weights => { :boost => 90, :product => 1120, :description => 100,
>>> :brand => 40 }
>>>
>>>
>>> def search_filters(flag="")
>>> defaults = { :active => 1 }
>>>
>>> if flag.include? "category"
>>> defaults[:category_ids] = params[:category_id]
>>> end
>>>
>>> if flag.include? "has_special_price"
>>> defaults[:has_special_price] = 1
>>> end
>>>
>>> if flag.include? "at_stock"
>>> defaults[:at_stock] = 1
>>> end
>>>
>>> Everything works fine in development mode - in production mode I will get a:
>>>
>>> ArgumentError (wrong number of arguments (1 for 0)):
>>> app/controllers/products_controller.rb:281:in `search_filters'
>>>
>>> What's wrong here?
>>>
>>> Thanx
>>>
>>> --
>>> 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.
>>>
>>
>> --
>> 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.
>>
>
> --
> 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.
>
--
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.