In order to add a facet that I want, I've hacked up a custom SQL call
that returns a comma-separated list of integers as the attribute
value.  Here's the exact code:

has "GROUP_CONCAT(DISTINCT
IFNULL(concat(month(trip_dates.departure_date),
year(trip_dates.departure_date)), 0) SEPARATOR ',')", :as
=> :departure_date, :facet => true, :type => :multi

Basically, I'm pulling in some dates and cobbling them together so I
have just the month and the year.  January 4, 2010 and January 21,
2010 both end up as 12010.  I have a custom process that translates
that number into a form that I can display in the UI

The problem is that any MVA (:type => :multi) attribute is
automatically translated if it's a list of integers, which mine is.  I
believe this happens because MVA is really only supposed to be used
internally for handling has_many and habtm relationship.  The
translate method seems to look up the class of this relationship and
"translate" the value into the appropriate object.

It's a nice feature, but I don't want it to fire in this particular
case.  I could monkeypatch ThinkingSphinx in my code but I'd rather
that be a last resort.  Posting a question to the group is a second-to-
last resort :)

Thanks,
Bob

-- 
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