Indexed Search Syntax

From MusicBrainz Wiki
(Redirected from Text Search Syntax)
Jump to navigationJump to search

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 every 3 hours, and thus may not reflect up to the minute changes. The direct search searches the database directly: 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, more advanced features can be found in the Lucene Search Syntax

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.
  • Any search for a specific date will currently also return any results that match the year or year and month alone. For example, a search for "1980-01-22" will also return all matches for "1980-01" and "1980". This is a known issue reported as SEARCH-634.

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

Recordings

type:album AND amadeus
  • search for recordings 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 recordings 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

Regular expressions

You can use regular expressions in your searches. For that you should put the expression between forward slashes (/regex/). Regular expression search generally searches only inside each token (word), so you cannot search for combinations of words as a regular expression. For an example, to find releases credited to either of the two common transliterations of Сергей Рахманинов, "Rachmaninov" and "Rachmaninoff", you can pass artist:/Rachmanino(ff|v)/ to the release search.

MusicBrainz-specific search fields

Area

Search Fields

The Area index contains the following fields you can search

Field Description
aid the area's MBID
alias (part of) any alias attached to the artist (diacritics are ignored)
area (part of) the area's name (diacritics are ignored)
areaaccent (part of) the area's name (with the specified diacritics)
begin the area's begin date (e.g. "1980-01-22")
comment (part of) the area's disambiguation comment
end the area's end date (e.g. "1980-01-22")
ended a boolean flag (true/false) indicating whether or not the area has ended (is no longer current)
iso an ISO 3166-1, 3166-2 or 3166-3 code attached to the area
iso1 an ISO 3166-1 code attached to the area
iso2 an ISO 3166-2 code attached to the area
iso3 an ISO 3166-3 code attached to the area
sortname equivalent to name (areas no longer have separate sort names)
tag (part of) a tag attached to the area
type the area's type

If you don't specify a field, the terms will be searched for in the area field.

Artist

Search Fields

The Artist index contains the following fields you can search

Field Description
alias (part of) any alias attached to the artist (diacritics are ignored)
primary_alias (part of) any primary alias attached to the artist (diacritics are ignored)
area (part of) the name of the artist's main associated area
arid the artist's MBID
artist (part of) the artist's name (diacritics are ignored)
artistaccent (part of) the artist's name (with the specified diacritics)
begin the artist's begin date (e.g. "1980-01-22")
beginarea (part of) the name of the artist's begin area
comment (part of) the artist's disambiguation comment
country the 2-letter code (ISO 3166-1 alpha-2) for the artist's main associated country
end the artist's end date (e.g. "1980-01-22")
endarea (part of) the name of the artist's end area
ended a boolean flag (true/false) indicating whether or not the artist has ended (is dissolved/deceased)
gender the artist's gender (“male”, “female”, “other” or “not applicable”)
ipi an IPI code associated with the artist
isni an ISNI code associated with the artist
sortname (part of) the artist's sort name
tag (part of) a tag attached to the artist
type the artist's type (“person”, “group”, etc.)

If you don't specify a field, the terms will be searched for in the alias, artist and sortname fields.

Event

Search Fields

The Event index contains the following fields you can search

Field Description
alias (part of) any alias attached to the artist (diacritics are ignored)
aid the MBID of an area related to the event
area (part of) the name of an area related to the event
arid the MBID of an artist related to the event
artist (part of) the name of an artist related to the event
begin the event's begin date (e.g. "1980-01-22")
comment (part of) the artist's disambiguation comment
end the event's end date (e.g. "1980-01-22")
ended a boolean flag (true/false) indicating whether or not the event has an end date set
eid the MBID of the event
event (part of) the event's name (diacritics are ignored)
eventaccent (part of) the event's name (with the specified diacritics)
pid the MBID of a place related to the event
place (part of) the name of a place related to the event
tag (part of) a tag attached to the event
type the event's type

If you don't specify a field, the terms will be searched for in the alias, artist and event fields.

Instrument

Search Fields

The instrument index contains these fields you can search:

Field Description
alias (part of) any alias attached to the instrument (diacritics are ignored)
comment (part of) the instrument's disambiguation comment
description (part of) the description of the instrument (in English)
iid the MBID of the instrument
instrument (part of) the instrument's name (diacritics are ignored)
instrumentaccent (part of) the instrument's name (with the specified diacritics)
tag (part of) a tag attached to the instrument
type the instrument's type

If you don't specify a field, the terms will be searched for in the alias, description and instrument fields.

Label

Search Fields

The Label index contains the following fields you can search

Field Description
alias (part of) any alias attached to the label (diacritics are ignored)
area (part of) the name of the label's main associated area
begin the label's begin date (e.g. "1980-01-22")
code the label code for the label (only the numbers, without "LC")
comment (part of) the label's disambiguation comment
country the 2-letter code (ISO 3166-1 alpha-2) for the label's associated country
end the label's end date (e.g. "1980-01-22")
ended a boolean flag (true/false) indicating whether or not the label has ended (is dissolved)
ipi an IPI code associated with the label
isni an ISNI code associated with the label
label (part of) the label's name (diacritics are ignored)
labelaccent (part of) the label's name (with the specified diacritics)
laid the label's MBID
release_count the amount of releases related to the label
sortname equivalent to name (labels no longer have separate sort names)
tag (part of) a tag attached to the label
type the label's type

If you don't specify a field, the terms will be searched for in the alias and label fields.

Place

Search Fields

The Place index contains the following fields you can search

Field Description
address (part of) the physical address for this place
alias (part of) any alias attached to the place (diacritics are ignored)
area (part of) the name of the place's main associated area
begin the place's begin date (e.g. "1980-01-22")
comment (part of) the place's disambiguation comment
end the place's end date (e.g. "1980-01-22")
ended a boolean flag (true/false) indicating whether or not the place has ended (is closed)
lat the (WGS 84) latitude of the place's coordinates (e.g. "58.388226")
long the (WGS 84) longitude of the place's coordinates (e.g. "26.702817")
place (part of) the place's name (diacritics are ignored)
placeaccent (part of) the place's name (with the specified diacritics)
pid the place's MBID
type the place's type


If you don't specify a field, the terms will be searched for in the address, alias, area and place fields.

Recording

Search Fields

The Recording index contains the following fields you can search

Field Description
alias (part of) any alias attached to the recording (diacritics are ignored)
arid the MBID of any of the recording artists
artist (part of) the combined credited artist name for the recording, including join phrases (e.g. "Artist X feat.")
artistname (part of) the name of any of the recording artists
comment (part of) the recording's disambiguation comment
country the 2-letter code (ISO 3166-1 alpha-2) for the country any release of this recording was released in
creditname (part of) the credited name of any of the recording artists on this particular recording
date the release date of any release including this recording (e.g. "1980-01-22")
dur the recording duration in milliseconds
firstreleasedate the release date of the earliest release including this recording (e.g. "1980-01-22")
format the format of any medium including this recording (insensitive to case, spaces, and separators)
isrc any ISRC associated to the recording
number the free-text number of the track on any medium including this recording (e.g. "A4")
position the position inside its release of any medium including this recording (starts at 1)
primarytype the primary type of any release group including this recording
qdur the recording duration, quantized (duration in milliseconds / 2000)
recording (part of) the recording's name, or the name of a track connected to this recording (diacritics are ignored)
recordingaccent (part of) the recordings's name, or the name of a track connected to this recording (with the specified diacritics)
reid the MBID of any release including this recording
release (part of) the name of any release including this recording
rgid the MBID of any release group including this recording
rid the recording's MBID
secondarytype any of the secondary types of any release group including this recording
status the status of any release including this recording
tag (part of) a tag attached to the recording
tid the MBID of a track connected to this recording
tnum the position of the track on any medium including this recording (starts at 1, pre-gaps at 0)
tracks the number of tracks on any medium including this recording
tracksrelease the number of tracks on any release (as a whole) including this recording
type legacy release group type field that predates the ability to set multiple types (see calculation code)
video a boolean flag (true/false) indicating whether or not the recording is a video recording

If you don't specify a field, the terms will be searched for in the recording field.

Release

Search Fields

The Release index contains the following fields you can search

Field Description
alias (part of) any alias attached to the release (diacritics are ignored)
arid the MBID of any of the release artists
artist (part of) the combined credited artist name for the release, including join phrases (e.g. "Artist X feat.")
artistname (part of) the name of any of the release artists
asin an Amazon ASIN for the release
barcode the barcode for the release
catno any catalog number for this release (insensitive to case, spaces, and separators)
comment (part of) the release's disambiguation comment
country the 2-letter code (ISO 3166-1 alpha-2) for any country the release was released in
creditname (part of) the credited name of any of the release artists on this particular release
date a release date for the release (e.g. "1980-01-22")
discids the total number of disc IDs attached to all mediums on the release
discidsmedium the number of disc IDs attached to any one medium on the release
format the format of any medium in the release (insensitive to case, spaces, and separators)
laid the MBID of any of the release labels
label (part of) the name of any of the release labels
lang the ISO 639-3 code for the release language
mediums the number of mediums on the release
packaging the format of the release (insensitive to case, spaces, and separators)
primarytype the primary type of the release group for this release
quality the listed quality of the data for the release (2 for “high”, 1 for “normal”; cannot search for “low” at the moment; see the related bug report)
reid the release's MBID
release (part of) the release's title (diacritics are ignored)
releaseaccent (part of) the release's title (with the specified diacritics)
rgid the MBID of the release group for this release
script the ISO 15924 code for the release script
secondarytype any of the secondary types of the release group for this release
status the status of the release
tag (part of) a tag attached to the release
tracks the total number of tracks on the release
tracksmedium the number of tracks on any one medium on the release
type legacy release group type field that predates the ability to set multiple types (see calculation code)

If you don't specify a field, the terms will be searched for in the release field.

Release Group

Search Fields

The release group index contains the following fields you can search:

Field Description
alias (part of) any alias attached to the release group (diacritics are ignored)
arid the MBID of any of the release group artists
artist (part of) the combined credited artist name for the release group, including join phrases (e.g. "Artist X feat.")
artistname (part of) the name of any of the release group artists
comment (part of) the release group's disambiguation comment
creditname (part of) the credited name of any of the release group artists on this particular release group
firstreleasedate the release date of the earliest release in this release group (e.g. "1980-01-22")
primarytype the primary type of the release group
reid the MBID of any of the releases in the release group
release (part of) the title of any of the releases in the release group
releasegroup (part of) the release group's title (diacritics are ignored)
releasegroupaccent (part of) the release group's title (with the specified diacritics)
releases the number of releases in the release group
rgid the release group's MBID
secondarytype any of the secondary types of the release group
status the status of any of the releases in the release group
tag (part of) a tag attached to the release group
type legacy release group type field that predates the ability to set multiple types (see calculation code)

If you don't specify a field, the terms will be searched for in the releasegroup field.

Series

Search Fields

The Series index contains the following fields you can search

Field Description
alias (part of) any alias attached to the series (diacritics are ignored)
comment (part of) the series' disambiguation comment
series (part of) the series' name (diacritics are ignored)
seriesaccent (part of) the series' name (with the specified diacritics)
sid the series' MBID
tag (part of) a tag attached to the series
type the series' type

If you don't specify a field, the terms will be searched for in the alias and series fields.

Work

Search Fields

The Work index contains the following fields you can search

Field Description
alias (part of) any alias attached to the work (diacritics are ignored)
arid the MBID of an artist related to the event (e.g. a composer or lyricist)
artist (part of) the name of an artist related to the work (e.g. a composer or lyricist)
comment (part of) the work's disambiguation comment
iswc any ISWC associated to the work
lang the ISO 639-3 code for any of the languages of the work's lyrics
recording (part of) the title of a recording related to the work
recording_count the number of recordings related to the work
rid the MBID of a recording related to the work
tag (part of) a tag attached to the work
type the work's type (e.g. "opera", "song", "symphony")
wid the work's MBID
work (part of) the work's title (diacritics are ignored)
workaccent (part of) the work's title (with the specified diacritics)

If you don't specify a field, the terms will be searched for in the alias and work fields.

Annotation

Search Fields

The Annotation index contains the following fields you can search

Field Description
entity the annotated entity's MBID
id the numeric ID of the annotation (e.g. 703027)
name the annotated entity's name or title (diacritics are ignored)
text the annotation's content (includes wiki formatting)
type the annotated entity's entity type

If you don't specify a field, the terms will be searched for in the name, text and type fields.

Tag

Search Fields

The tag index contains these fields you can search:

Field Description
tag (part of) the tag's name

CD Stub

Search Fields

The CD stub index contains the following fields you can search:

Field Description
added the date the CD stub was added (e.g. "2020-01-22")
artist (part of) the artist name set on the CD stub
barcode the barcode set on the CD stub
comment (part of) the comment set on the CD stub
discid the CD stub's Disc ID
title (part of) the release title set on the CD stub
tracks the number of tracks on the CD stub

If you don't specify a field, the terms will be searched for in the artist and title fields.

Editor

Search Fields

The Editor index contains the following fields you can search

Field Description
editor (part of) the editor's name
bio (part of) the editor's bio

If you don't specify a field, the terms will be searched for in the editor and bio fields.