tashfeen.ekram wrote:
> Thanks for you answer.
>
> I am a little confused by your beofre_filter comment. Would you not
> want to use an after_filter so that once the model has been updated
> you update the DB? I assume you mean the before_filter for
> controllers.
Sorry, that was badly worded.
I meant a before_validation or before_save callback on your model.
For example, I wanted the products in my system to be sortable by title
in sphinx, ignoring case and accents. I've added a "sort_title" string
attribute to my model, and have the following before_validation_filter:
class Product < ActiveRecorde::Base
...
before_validation :set_sphinx_columns
private
def set_sphinx_columns
self.sort_title =
self.title.to_s.mb_chars.normalize(:kd).gsub(/[^\x00-\x7F]/n, '').upcase
end
...
end
I don't fully grok your scenario, but it sounds like you could do
something similar, then point the sphinx index at the new column to get
it to recognise the data you need.
-- James Healy <[email protected]> Thu, 22 Apr 2010 01:06:50 +1000
--
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.