Indexed Search Syntax: Difference between revisions
mNo edit summary |
mNo edit summary |
||
Line 1: | Line 1: | ||
{{DocumentationHeader}} |
{{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 |
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, but it can only carry out simple keyword searches with no boolean logic, but it is always up-to-date. |
||
==Overview== |
==Overview== |
||
Line 13: | Line 13: | ||
;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''). |
;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 [[Text Search Syntax#query-syntax|Query Syntax]] describe simple and commonly used operators, |
The sections below [[Text Search Syntax#query-syntax|Query Syntax]] describe simple and commonly used operators, more advanced features can be found in the [http://lucene.apache.org/java/2_4_0/queryparsersyntax.html Lucene documentation]. |
||
But first take a look at a few simple examples which might show everything necessary for the majority of your searches. |
But first take a look at a few simple examples which might show everything necessary for the majority of your searches. |
||
Line 41: | Line 41: | ||
::* search for releases from Germany in 1999 with the word ''rock'' in them |
::* search for releases from Germany in 1999 with the word ''rock'' in them |
||
=== |
===Recordings=== |
||
:'''type:album AND amadeus''' |
:'''type:album AND amadeus''' |
||
::* search for |
::* search for recordings with the title ''amadeus'' from albums |
||
:'''day life''' |
:'''day life''' |
||
::* will retrieve ''A Day In The Life'' |
::* will retrieve ''A Day In The Life'' |
||
Line 61: | Line 61: | ||
::* will not retrieve ''That's Life'' |
::* will not retrieve ''That's Life'' |
||
:'''"voodoo people" AND artist:"the prodigy"''' |
:'''"voodoo people" AND artist:"the prodigy"''' |
||
::* search for all |
::* search for all recordings with the title ''Voodoo People'' by the artist ''The Prodigy'' |
||
<span id="query-syntax"></span> |
<span id="query-syntax"></span> |
||
Line 94: | Line 94: | ||
| comment || artist comment to differentiate similar artists |
| comment || artist comment to differentiate similar artists |
||
|- |
|- |
||
| gender || |
| gender || gender of the artist (“male”, “female”, “other”) |
||
|- |
|- |
||
| tag || |
| tag || a tag applied to the artist |
||
|- |
|- |
||
| sortname || artist sortname |
| sortname || artist sortname |
||
|- |
|- |
||
| type || artist type (“person” or |
| type || artist type (“person”, “group” or “unknown”) |
||
|- |
|- |
||
| begin || artist birth date/band founding date |
| begin || artist birth date/band founding date |
||
Line 111: | Line 111: | ||
===Release Groups=== |
===Release Groups=== |
||
The |
The release group index contains the following fields you can search: |
||
{| border="1" class="wikitable sortable" |
{| border="1" class="wikitable sortable" |
||
|- |
|- |
||
Line 153: | Line 153: | ||
| artist || name of the artist as it appears on the cover |
| artist || name of the artist as it appears on the cover |
||
|- |
|- |
||
| artistname || |
| artistname || MusicBrainz name of any artist which appears in the artist credits |
||
|- |
|- |
||
| creditname || name of any artist in the artist credit as it appears on the cover |
| creditname || name of any artist in the artist credit as it appears on the cover |
||
Line 169: | Line 169: | ||
| mediums || number of mediums on the release |
| mediums || number of mediums on the release |
||
|- |
|- |
||
| discids || number of [[Disc ID| |
| discids || number of [[Disc ID|disc IDs]] for the release |
||
|- |
|- |
||
| discidsmedium || number of [[Disc ID| |
| discidsmedium || number of [[Disc ID|disc IDs]] for any medium of the release |
||
|- |
|- |
||
| date || date for the release |
| date || date for the release |
||
|- |
|- |
||
| asin || the Amazon ASIN for |
| asin || the Amazon ASIN for the release |
||
|- |
|- |
||
| lang || |
| lang || the language for this release. Use the [http://www.loc.gov/standards/iso639-2/php/code_list.php three character ISO 639 codes] to search for a specific language. (e.g. lang:eng) |
||
|- |
|- |
||
| script || |
| script || the [http://unicode.org/iso15924/iso15924-codes.html 4 character script code] (e.g. latn) used for this release |
||
|- |
|- |
||
| country || |
| country || the [http://www.iso.org/iso/country_codes/iso_3166_code_lists/english_country_names_and_code_elements.htm two letter country code] for the release country |
||
|- |
|- |
||
| label || |
| label || the name of a label for this release |
||
|- |
|- |
||
| labelid || |
| labelid || the MBID of a label for this release |
||
|- |
|- |
||
| catno || |
| catno || the catalog number for this release |
||
|- |
|- |
||
| barcode || |
| barcode || the barcode for this release |
||
|- |
|- |
||
| puid || PUID of a track on the release |
| puid || PUID of a track on the release |
||
Line 211: | Line 211: | ||
| artist || name of the artist as it appears on the track list |
| artist || name of the artist as it appears on the track list |
||
|- |
|- |
||
| artistname || |
| artistname || MusicBrainz name of any artist included in the Artist Credit |
||
|- |
|- |
||
| creditname || name of any artist as credited |
| creditname || name of any artist as credited |
||
Line 242: | Line 242: | ||
|} |
|} |
||
Recording search terms with no fields search the ''recording'' field only. |
|||
===Works=== |
===Works=== |
||
Line 320: | Line 320: | ||
|} |
|} |
||
=== |
===CD Stubs=== |
||
The [[CD Stub]] index contains the following fields you can search: |
The [[CD Stub]] index contains the following fields you can search: |
||
{| border="1" class="wikitable sortable" |
{| border="1" class="wikitable sortable" |
||
Line 336: | Line 336: | ||
| tracks || number of tracks on the CD stub |
| tracks || number of tracks on the CD stub |
||
|- |
|- |
||
| discid || [[Disc ID| |
| discid || [[Disc ID|disc ID]] of the CD |
||
|- |
|- |
||
| added || date(?) added |
| added || date(?) added |
Revision as of 21:16, 14 June 2011
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, 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, more advanced features can be found in the Lucene documentation.
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.
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
MusicBrainz-specific search fields
Artists
The artist index contains the following fields you can search:
Field | Description |
---|---|
arid | MBID of the artist |
artist | name of the artist |
alias | the aliases/misspellings for the artist |
comment | artist comment to differentiate similar artists |
gender | gender of the artist (“male”, “female”, “other”) |
tag | a tag applied to the artist |
sortname | artist sortname |
type | artist type (“person”, “group” or “unknown”) |
begin | artist birth date/band founding date |
end | artist death date/band dissolution date |
Artist search terms with no fields specified search the artist, sortname and alias fields.
Release Groups
The release group index contains the following fields you can search:
Field | Description |
---|---|
arid | MBID of the release group’s artist |
artist | release group artist as it appears on the cover (Artist Credit) |
artistname | “real name” of any artist that is included in the release group’s artist credit |
creditname | name of any artist in multi-artist credits, as it appears on the cover. |
rgid | MBID of the release group |
releasegroup | name of the release group |
type | type of the release group (album, single, ep, compilation, soundtrack, spokenword, interview, audiobook, live, remix, other) |
release | name of a release that appears in the release group |
reid | MBID of a release that appears in the release group |
tag | a tag that appears on the release group |
Releases
The release index contains these fields:
field | Description |
reid | MBID of the release |
release | name of the release |
arid | MBID of an artist appearing on this release |
artist | name of the artist as it appears on the cover |
artistname | MusicBrainz name of any artist which appears in the artist credits |
creditname | name of any artist in the artist credit as it appears on the cover |
type | type of the release group in which the release appears (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.) |
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 disc IDs for the release |
discidsmedium | number of disc IDs for any medium of the release |
date | date for the release |
asin | the Amazon ASIN for the release |
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 MBID of a label for this release |
catno | the catalog number for this release |
barcode | the barcode for this release |
puid | PUID of a track on the release |
Release search terms with no fields search the release field only.
Recordings
Recording searches can contain:
Field | Description |
---|---|
rid | MBID of the recording |
recording | name of the recording |
arid | MBID of any artist credited on the recording |
artist | name of the artist as it appears on the track list |
artistname | MusicBrainz name of any artist included in the Artist Credit |
creditname | name of any artist as credited |
reid | MBID of any release on which this recording appears |
release | name of any release on which this recording appears |
type | release type (album, single, ep, compilation, soundtrack, spokenword, interview, audiobook, live, remix, other) |
status | release status (official, bootleg, promo, pseudo-release) |
tracks | number of tracks on the medium where this recording appears |
position | disc number in a multi-disc release where this recording appears |
tracksrelease | total number of tracks on all mediums of the release where this track appears |
dur | duration of recording in milliseconds |
qdur | quantized duration (duration / 2000) |
tnum | track number on any release where the recording appears |
isrc | ISRC of the recording |
tag | a tag which has been applied to this recording |
date | date of any release where this recording appears (note: NOT the date of performance of the recording) |
Recording search terms with no fields search the recording field only.
Works
Works searches can contain:
Field | Description |
---|---|
arid | MBID of any artist related to the work |
artist | name of any artist related to the work |
artistrelation | relationship of an artist to the work (FIXME: needs some more description) |
wid | MBID of the work |
work | name of the work |
iswc | any ISWC of the work |
type | type of the work |
alias | the aliases/misspellings for the work |
tag | any tag applied to the work |
Labels
The label index contains the following fields you can search:
Field | Description |
---|---|
laid | MBID of the label |
label | name of the label |
sortname | sortname of the label |
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 the label |
tag | any tag applied to the label |
FreeDB Releases
The FreeDB index contains the following fields you can search:
Field | Description |
---|---|
artist | artist name |
title | release name |
discid | FreeDB disc id |
cat | FreeDB category |
year | year |
tracks | number of tracks in the release |
CD Stubs
The CD Stub index contains the following fields you can search:
Field | Description |
---|---|
artist | artist name |
title | release name |
barcode | release barcode |
comment | general comments about the release |
tracks | number of tracks on the CD stub |
discid | disc ID of the CD |
added | date(?) added |