Currently I'm using solr to search the database. I want to sort that is up to a date
Problem:. The date is in the form of serial form in the database because it can be localized
My argument will be considered for a country. Specific entry and - if not, use the default.
Then it may look like this:
[["DE" => "Localized"}, {"EN" = & gt; "Localized"}, ...]
or like it:
[{ "default" = & gt; "Defaultdate"}]
Now, my class looks like this
class product & lt; ActiveRecord :: Base serialize: color array serialize: variants array serialize: images, array serialize: size, array serialize: Online_from array searched text: dw_productid ,: display_name ,: SHORT_DESCRIPTION time: online_from # date that Solr end termination shall take for sorting
the problem is that I just can not pass: online_from
to solr I can how to incorporate a logic here? What do I have to do that model ?? In
Thank you
Benjamin
Finally, I thought How to do this: So inside the search method, you can add Classroom Products & lt; ActiveRecord :: Base time: do something
to do more stuff with it.
serialize: color array serialize: variants array serialize: images, array serialize: size, array serialize: Online_from array searchable text: dw_productid: display_name ,: SHORT_DESCRIPTION #Or Online Time Sort By: online_from do | Onlinefromdate | If onlinefromdate.online_from [0]! = Zero @onlinefromdate = onlinefromdate.online_from [0] ["de"] If onlinefromdate.online_from [0] ["de"]! = Zero @onlinefromdate = onlinefromdate.online_from [0] [ "default"] If onlinefromdate.online_from [0] [ "default"]! = Zero @onlinefromdate = onlinefromdate.online_from [0] [0] Any @onlinefromdate = Date.parse ('2001/02/03') End end end
Comments
Post a Comment