Class | MusicBrainz::Model::ScoredCollection |
In: |
lib/rbrainz/model/scored_collection.rb
|
Parent: | Collection |
A ScoredCollection is a list of entities with scores.
A ScoredCollection is returned as the result of an entity search (e.g. search for an Artist). It contains an ordered list of Entry objects which wrap the entities and a corresponding search score, which indicates how good the entity matches the search criteria used for the search. The entities in a scored collection are sorted by score (in descending order).
A collection object may only store an extract of the complete data available on the server. This is especially the case if the limit or offset filter was used in the query. The collection object makes the total number of elements on the server and the current offset available with the count respective the offset parameter.
See lucene.apache.org/java/docs/scoring.html for more information about the scoring system used by MusicBrainz.
Add a new entry to the collection. . Returns self.
You may either add a ScoredCollection::Entry, just an Model::Entity or an object responding to first and last where first must return the entity and last the score.
Examples:
include MusicBrainz artist = Model::Artist.new collection << Model::ScoredCollection::Entry.new(artist, 100) collection << [artist, 100] collection << artist # Add several entities in one line collection << artist_one << artist_two
Set the entry at the given position.
You may either add a ScoredCollection::Entry, just an Model::Entity or an object responding to first and last where first must return the entity and last the score.