Ferret: TUTORIAL
Popularity Report
![]() |
|||
![]() |
|||
![]() |
|||
![]() |
|||
![]() |
|||
![]() |
URL Tag Cloud
Bookmark History
Saved by 6 people (3 private), first by anonymouse user on 2006-09-04
- Dotgrex on 2007-09-06 - Tags delicious , ferret , lucene , permanento , programming , rails , ruby , rubyonrails , search , tutorial
- Ken on 2007-08-20 - Tags ferret , lucene , ruby
- Joel on 2007-05-19 - Tags engine , ferret , search , tutorial
- Ktorek on 2007-05-09 - Tags programowanie , rails , search
- Eban777 on 2006-11-29 - Tags toread
Public Sticky notes
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 this
index["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.
Highlighted by ken


Public Comment