This is what im trying to do (psuedo(ish) code)
basically just applying filters to the search if params exist.
I realise this is probably a dumb question.
DistributerGame.search :conditions => {:game_genre => genre *** IF
PARAMS[GENRE] EXISTS ***}, :with => {:distributer_id => distributer *** if
PARAMS[DISTRIBUTER] EXISTS ***, :price_in_gbp =>
gbp_price_low..gbp_price_high} *** if PARAMS[PRICE] EXISTS ***, :per_page
=> games_per_page
Thanks,
Matt
On Monday, November 19, 2012 1:39:41 PM UTC, Matt Bilbow wrote:
>
> Thanks Pat, that's what I ended up doing :)
>
> I do however have a new problem.
>
> I'm passing multiple params from a faceted search back to my controller.
> Do you know of a way I can 'chain' these to filter my results?
>
> Thanks again,
>
> Matt
>
>
>
>
>
> On Saturday, November 17, 2012 8:04:46 PM UTC, Matt Bilbow wrote:
>>
>> Here's my set up.
>>
>> Game model
>> title
>> description
>>
>> Distributer
>> title
>> link
>>
>> DistributerGame associated model
>> game_id
>> distributer_id
>> link
>>
>> I'm trying to add the define_index block to my DistributerGame model.
>>
>> define_index do
>> join distributer_game.game
>> # fields
>> indexes game.title, :as => :game_title
>>
>> # attributes
>> has game_id, :type => :integer, :as => :game_id
>> has distributer_id, :type => :integer, :as => :distributer_id,
>> :facet => true
>> end
>>
>> when i try to index i get the following error:
>>
>> Cannot automatically map attribute sphinx_internal_id in DistributerGame
>> to an
>> equivalent Sphinx type (integer, float, boolean, datetime, string as
>> ordinal).
>> You could try to explicitly convert the column's value in your
>> define_index
>> block:
>> has "CAST(column AS INT)", :type => :integer, :as => :column
>>
>> I'm guessing this has somethingt o do with having no primary key? but
>> have no idea how to move forwards. Any help would be REALLy appreciated.
>>
>> Thanks,
>> Matt
>>
>>
--
You received this message because you are subscribed to the Google Groups
"Thinking Sphinx" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/thinking-sphinx/-/GxFMh87k9OwJ.
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.