Hi,

I search for some topics related to MVA but couldn't find a solution
for it. Reading TS code and docs, I found that facets uses CRC32 due
to a limitation with strings.

So I took this idea to query over MVA with string values, this is my
scenario:

class Category < ActiveRecord::Base
  belongs_to :post

  validates_presence_of :name
end

class Post < ActiveRecord::Base
  has_many :categories

  define_index do
    indexes :title

    has categories(:name), :as => :category_crcs, :crc => true
  end
end

So, since sphinx doesn't accept string as a type for MVA (only uint or
timestamp), I convert every input to its crc value, so I can query as
a integer.

Post.search :with => { :category_crcs => "Some Category".to_crc32 }

And it works.

Is there any better option?

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