Function rescoped

Source
pub fn rescoped(query: &Query, scope: Scope) -> Query
Expand description

The same question, asked of the album or the artist instead of the track.

Every field the user writes carries a scope, and a bare rating, tag or note means the track’s own. That is deliberate — five stars on an artist is not five stars on a track — but it makes one answer badly misleading: somebody who rated an album types rating, is told nothing matches, and concludes the feature is broken. It is not; they asked a different question from the one they meant. (loved is the one exception: see Field::LovedAnywhere, which already looks past the track, so there is nothing here for it to rescope.)

So a caller that gets an empty result can ask the same question again at another scope, and — if that answers — say which scope holds what was written. The suggestion is only ever a suggestion: the query itself keeps meaning exactly what it says.

Fields that carry no scope are left alone, so a mixed expression such as genre:metal rating is rescoped only where rescoping means something.