1. acts_as_solr forked

    2 October 2008

    I have forked acts_as_solr on GitHub Why? Well, because I wasn’t too happy with the way acts_as_solr was indexing associations.


    class Person acts_as_solr :include => [:dog]
    has_one :dog
    end

    acts_as_solr would index this as:

    first_name_t:John
    last_name_t:Doe
    id_t:1
    ...
    dog_t:name=Rover color=brown sex=male

    Do you see how all of the associated fields are lumped into one string? So I wanted to be able to search against the association’s values just like the parent. Anyway, now my forked version will index this association like this:

    first_name_t:John
    last_name_t:Doe
    id_t:1
    ...
    dog_name_t:Rover
    dog_color_t:brown
    dog_sex_t:male

    So what if we had the following association:

    has_many :dogs

    Well, my fork will index as follows:

    dog_name_t:Rover Clifford
    dog_color_t:brown yellow
    dog_sex_t:male female

    This way you can still do a solr text search against those unique field names. I’d appreciate any suggestions.