Search Server: Difference between revisions
Ianmcorvidae (talk | contribs) (added location, description-ish) |
PavanChander (talk | contribs) No edit summary |
||
Line 1: | Line 1: | ||
Search queries on musicbrainz.org are handled by an [http://lucene.apache.org/java/docs/index.html Apache Lucene] server. This search server also handles searches performed on the web service and uses Lucene indexes in either case to return its results. |
|||
⚫ | |||
The [[MusicBrainz XML Meta Data]] (MMD schema) is used to determine the output returned from the search server. |
|||
This is the output currently returned from the Search Server, this has to match the [[MusicBrainz XML Meta Data|MMD]] schema, the Search Server serves results from Lucene indexes. The Search Server is NOT the webservice but is used by the [[WebServiceSearch]] to perform searches, and is also used by the Web Interface to perform searches. The webservice will return the xml exactly as shown on this page, the webpage will receive a JSON'd version of the XML which it will render as Html. |
|||
⚫ | |||
== Query parameters == |
|||
Some of the entities provided by the Search Server are currently only returned by the webpage and not the web service, these are annotation, tags, cdstubs and freedb, only these are documented here the other entities are documemented at [[WebServiceSearch]] . |
Some of the entities provided by the Search Server are currently only returned by the webpage and not the web service, these are annotation, tags, cdstubs and freedb, only these are documented here the other entities are documemented at [[WebServiceSearch]] . |
Revision as of 22:37, 18 January 2012
Search queries on musicbrainz.org are handled by an Apache Lucene server. This search server also handles searches performed on the web service and uses Lucene indexes in either case to return its results.
The MusicBrainz XML Meta Data (MMD schema) is used to determine the output returned from the search server.
Most mirror installations of MusicBrainz Server can simply use our public search server rather than setting up their own. For those curious, however, the search server code is available from our Subversion server at http://bugs.musicbrainz.org/browser/search_server.
Query parameters
Some of the entities provided by the Search Server are currently only returned by the webpage and not the web service, these are annotation, tags, cdstubs and freedb, only these are documented here the other entities are documemented at WebServiceSearch .
This sections lists the parameters common to all resource.
type | Selects the index to be searched, artist, release, release-group, recording, work, label (track is supported but maps to recording) |
format | Selects the representation of the resource. Defaults to xml, but can also be json (for parsing to html) |
query | Lucene search query, this is mandatory |
limit | An integer value defining how many entries should be returned. Only values between 1 and 100 (both inclusive) are allowed. If not given, this defaults to 25. |
offset | Return search results starting at a given offset. Used for paging through more than one page of results. |
version | MMD version, defaults to 2, can be set to 1 for backwards compatibility. |
Annotation
The annotation index contains the following fields you can search:
field | Description |
entity | musicbrainz id of the entity that this annotation is about |
name | artist name |
text | the annotation itself |
type | the type of entity the annotation relates to (artist, release, label, track, releasegroup) |
Annotation search terms with no fields specified search the text field.
Example: http://localhost:8080/ws/2/annotation/?query=mbid:bdb24cb5-404b-4f60-bba4-7b730325ae47
Xml
<metadata xmlns="http://musicbrainz.org/ns/mmd-2.0#" xmlns:ext="http://musicbrainz.org/ns/ext#-2.0"> <annotation-list offset="0" count="1"> <annotation type="release"> <entity>bdb24cb5-404b-4f60-bba4-7b730325ae47</entity> <text>EAN: 0828768226629 - DiscID: TWj6cLku360MfFYAq_MEaT_stgc-</text> </annotation> </annotation-list> </metadata>
Json
{"annotation-list":{"offset":0,"count":1,"annotation":[{"type":"release","entity":"bdb24cb5-404b-4f60-bba4-7b730325ae47", "text":"EAN: 0828768226629 - DiscID: TWj6cLku360MfFYAq_MEaT_stgc-"}]}}
CdStub
The cdstub index contains these fields you can search:
field | Description |
artist | main artist of the CD |
title | title of the CD |
barcode | barcode of the CD |
comment | comment |
discid | CD discid |
tracks | total tracks on the CD |
CdStub index search terms with no fields search the artist and title fields only.
Example: Doo http://localhost:8080/ws/2/cdstub/?query=title:Doo Doo
Xml
<metadata xmlns="http://musicbrainz.org/ns/mmd-2.0#" xmlns:ext="http://musicbrainz.org/ns/ext#-2.0"> <cdstub-list offset="0" count="1"> <cdstub id="qA87dKURKperVfmckD5b_xo8BO8-"> <title>Doo Doo First</title> <artist>Doo Doo</artist> <barcode>837101029193</barcode> <comment>CD Baby id:vozzolo</comment> <track-list count="2"/> </cdstub> </cdstub-list> </metadata>
Json
{"cdstub-list":{"offset":0,"count":1,"cdstub":[{"id":"qA87dKURKperVfmckD5b_xo8BO8-","title":"Doo Doo First", "artist":"Doo Doo","barcode":"837101029193","comment":"CD Baby id:vozzolo","track-list":{"count":2}}]}}
FreeDB
The FreeDB index contains these fields you can search:
field | Description |
artist | main artist of the this freedb release |
title | title of the freedb release |
discid | disc |
category | category |
year | year of release |
tracks | number of tracks on the release |
FreeDB index search terms with no fields search the artist and title fields only.
Example: http://localhost:8080/ws/2/freedb/?query=artist:Ska-P
Xml
<metadata xmlns="http://musicbrainz.org/ns/mmd-2.0#" xmlns:ext="http://musicbrainz.org/ns/ext#-2.0"> <freedb-disc-list offset="0" count="1"> <freedb-disc id="c20c4b0d"> <title>Lágrimas & Gozos</title> <artist>Ska-P</artist> <category>folk</category> <year>2008</year> <track-list count="13"/> </freedb-disc> </freedb-disc-list> </metadata>
Json
{"freedb-disc-list":{"offset":0,"count":1,"freedb-disc":[{"id":"c20c4b0d","title":"Lágrimas & Gozos","artist":"Ska-P", "category":"folk","year":"2008","track-list":{"count":13}}]}}
Tag
The Tag index contains these fields you can search:
field | Description |
tag | tag |
Example: http://localhost:8080/ws/2/tag?query=tag:rock
Xml
<metadata xmlns="http://musicbrainz.org/ns/mmd-2.0#" xmlns:ext="http://musicbrainz.org/ns/ext#-2.0"> <tag-list offset="0" count="2"> <tag ext:score="100"><name>rock</name></tag> <tag ext:score="62"><name>classic rock</name></tag> </tag-list></metadata>
Json
{"tag-list":{"offset":0,"count":2,"tag":[{"score":"100","name":"rock"},{"score":"62","name":"classic rock"}]}}