Reputation: 6660
I want to search and filter using sunspot. I want to filter using month number on a date field "date_start". How can i filter using just the month part of my date field?
I tried something like this :
with(:date_start).greater_than(3)
Thank you for help
Upvotes: 0
Views: 290
Reputation: 901
Add a virtual attribute to your model, for example:
def month
self.date_start.strftime('%m')
end
Then add it to index and search it!
Upvotes: 2