4

I'm trying to do a priority "order by" on a multiple-value field using solr - any idea how I can accomplish the below?

searchable do
  integer :skill_ids, :multiple => true
end

def self.filter_using_solr(opts={})
  Sunspot.search(JobApplication) do |s|
    opts[:order_skill_ids].each do |skill_id|
        s.order_by(:skill_ids, skill_id)
      end
    end
  end
end

I get the following exception "skill_ids cannot be used for ordering because it is a multiple-value field" - but not sure on the alternate path.

Cœur
  • 37,241
  • 25
  • 195
  • 267
Nathan Bertram
  • 1,079
  • 11
  • 18

1 Answers1

3

Perhaps what you're looking for is Solr's faceted search.

There are several posts on this subject including How do I set up a facet search with a many to many relationship using Sunspot?

Naturally, the Solr docs are also useful.

Community
  • 1
  • 1
Alec Wenzowski
  • 3,878
  • 3
  • 25
  • 40