Closed kapso closed 9 years ago
Figured thus out, I will have to define
index :first_name
index :last_name
Yes, that's the way to define multiple indices. Note that any method can be indexed, so if you ever have a need of a composed index, you can build it like this:
class Propect < Ohm::Model
attribute :first_name
attribute :last_name
index :full_name
def full_name
"#{first_name} #{last_name}"
end
end
Prospect.find(full_name: "Jeff Cad")
Of course full_name
is not the best use case for a composed index! I just wanted to mention the idea just in case you ever need it.
Can you create an index on multiple attributes? So something like this...