This link has been bookmarked by 7 people . It was first bookmarked on 04 Sep 2006, by Paweł Kruszewski.
-
-
Let‘s go back to the database example above. If we store all of our
documents with an id then we can access that field using the id. As long as
we called our id field :id we can do thisindex["89721347"]["title"]
Pretty simple huh? You should note though that if there are more then one
document with the same id or key then only the first one will
be returned so it is probably better that you ensure the key is unique
somehow. By setting Index‘s :key attribute to :id, Ferret will do this automatically for
you. It can even handle multiple field primary keys. For example, you could
set to :key to [:id, :model] and Ferret would keep the documents unique
for that pair of fields.
-
Would you like to comment?
Join Diigo for a free account, or sign in if you are already a member.