Difference between revisions of "Indexed Search Syntax"

From MusicBrainz Wiki
Jump to navigationJump to search
(Update for NGS)
Line 107: Line 107:
 
| arid || artist id
 
| arid || artist id
 
|-
 
|-
| tagcount || The number of tags applied to the artist
+
| tagcount || The number of tags applied to the artist '''Broken'''
 
|}
 
|}
   

Revision as of 22:38, 9 June 2011

Template:DocumentationHeader

This page describes the syntax for MusicBrainz indexed searches which use the Lucene text search engine. The search indexes for these types of searches are updated once a day, and thus may not reflect up to the minute changes. The direct search searches the database directly, but it can only carry out simple keyword searches with no boolean logic, but it is always up-to-date.

Overview

Lucene offers much flexibility in defining search queries for all needs imaginable. To make it easier to understand, this page was divided into subpages. While this one offers an introduction to the most commonly used features, the others explain more advanced search operators and constructs.

First some words on the the terminology used in these pages:

Query
A query is the complete expression you put in one of the search fields.
Term
A term is the smallest unit inside a query. In the default case each single word inside a query is a term of its own, except for ...
Phrases
A phrase is a groups of words surrounded by quotation marks. Even though it's containing more than one word, a phrase is handled like a term.
Operators
or search operators are special characters and words that define either how single terms are processed by the search system (e.g. in -house the - tells the search system, not to return anything with the word house) or how to terms are to be combined in the search (e.g. one AND love means search for anything that has both words one and love).

The sections below Query Syntax describe simple and commonly used operators, in /AdvancedSyntax you'll find the more complicated and seldomly needed features of the search interface.

But first take a look at a few simple examples which might show everything necessary for the majority of your searches.

Notes

  • It is not possible to search for an album based on its track length, however, it is possible to search via total number of tracks.
  • It is not possible to search for releases based on media type, e.g. media:1 where "1" is the CD media.

Example searches

Artists

tori amos
  • search artist, sortname and alias fields
comment:electronic
  • search for the word electronic in artist disambiguation (comment) fields
begin:1984 AND type:group
  • search for all groups formed in 1984

Releases

café del mar
  • search for all Café del Mar albums
"the understanding" AND artist:royksopp
  • search for the album The Understanding by the artist Röyksopp
date:1999 AND country:de AND rock
  • search for releases from Germany in 1999 with the word rock in them

Tracks

type:album AND amadeus
  • search for tracks with the title amadeus from albums
day life
  • will retrieve A Day In The Life
  • will retrieve Life In A Day
  • will retrieve This Day
  • will retrieve That's Life
day AND life
  • will retrieve A Day In The Life
  • will retrieve Life In A Day
  • will not retrieve This Day
  • will not retrieve That's Life
"day in the life"
  • will retrieve A Day In The Life
  • will not retrieve Life In A Day
  • will not retrieve This Day
  • will not retrieve That's Life
"voodoo people" AND artist:"the prodigy"
  • search for all tracks with the title Voodoo People by the artist The Prodigy

Query syntax

Wildcards

To perform a single character wildcard search use the "?" symbol. To perform a multiple character wildcard search use the "*" symbol. For example, to search for "text" or "test" you can use the search te?t, to search for "test", "tests" or "tester", you can use the search test*.

Note: You cannot use a * or ? symbol as the first character of a search.

Fuzzy searches

To do a fuzzy search use the tilde, "~", symbol at the end of a single word term. Optionally can specify the required similarity, a value is between 0 and 1. For example to search for a term similar in spelling to "roam" use the fuzzy search roam~ or roam~0.8

MusicBrainz specific search fields

Artists

The artist index contains the following fields you can search:

field Description
artist artist name
alias the aliases/misspellings for this artist
comment artist comment to differentiate similar artists
gender Gender of the artist (“male” or “female”
tag A tag applied to the artist
sortname artist sortname
type artist type (“person” or “group”)
begin artist birth date/band founding date
end artist death date/band dissolution date
arid artist id
tagcount The number of tags applied to the artist Broken

Artist search terms with no fields specified search the artist, sortname and alias fields.

Releases

The release index contains these fields:

field Description
reid release id
release release name
arid artist id
artist artist name
artistcredit artist name as it appears on the cover
type release type (album, single, ep, compilation, soundtrack, spokenword, interview, audiobook, live, remix, other)
status release status (official, promotion, bootleg, pseudo-release)
format the format of the medium (CD, DVD, Vinyl, digital media, etc.) broken in NGS
tracks number of tracks in the release
tracksmedium number of tracks on any medium of the release
mediums number of mediums on the release
discids number of discIDs for the release
discidsmedium number of discIDs for any medium of the release
date date for the release
asin the Amazon ASIN for
lang The language for this release. Use the three character ISO 639 codes to search for a specific language. (e.g. lang:eng)
script The 4 character script code (e.g. latn) used for this release
country The two letter country code for the release country
label The name of a label for this release
labelid The ID of a label for this release
catno The catalog number for this release
barcode The barcode in a release event attached to a release
puid PUID of a track on the release

Release search terms with no fields search the release field only.

Tracks

And track searches can contain:

field Description
trid track id
track track name
arid artist id
artist artist name
reid release id
release release name
type release type (album, single, ep, compilation, soundtrack, spokenword, interview, audiobook, live, remix, other)
tracks number of tracks in the release
dur duration of track in milliseconds
qdur quantized duration (duration / 2000)
tnum track number

Track search terms with no fields search the track field only.

Labels

The label index contains the following fields you can search:

field Description
laid label id
label label name
sortname label sortname
type label type
code label code (only the figures part, i.e. without "LC")
country The two letter country code of the label country
begin label founding date
end label dissolution date
comment label comment to differentiate similar labels
alias the aliases/misspellings for this label

FreeDB Releases

The FreeDB index contains the following fields you can search:

field Description
artist artist name
title release name
discid FreeDB id
cat FreeDB category
year year
tracks number of tracks in the release