You'll need to extract the year into an attribute using a bit of SQL:

  has "substring(date_column, 3, 4)", :as => :start_year, :type => :integer

No idea whether substring exists in MySQL or PostgreSQL, so consider the above 
as a pseudo-code example. Filtering though is like so:

  Model.search :with => {:start_year => 0..2010}

This doesn't take months into account, though, but you get the idea :)

-- 
Pat

On 11/10/2011, at 4:58 PM, mohitnegi wrote:

> I am storing my date field as a string format in my database i.e. "Jun2011",
> 
> Now is there a way that while filtering sphinx search i can have integer 
> search.
> 
> like i want to search for all data with year less than 2011,  how can i do 
> that
> 
> Something like  Model.search :with{:start_year.<something>=>0..2011}
> 
> -- 
> 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/-/vNULtbWWiGcJ.
> 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.

Reply via email to