Skip to content

Commit

Permalink
Improve search example
Browse files Browse the repository at this point in the history
  • Loading branch information
Borewit committed Jan 19, 2025
1 parent b7f78b7 commit 48f3990
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -308,9 +308,9 @@ Arguments:
- `query.offset`: optional, return search results starting at a given offset. Used for paging through more than one page of results.
- `limit.query`: optional, 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.
For example, to find any recordings of _'We Will Rock You'_ by Queen:
For example, to search for _release-group_: _"We Will Rock You"_ by _Queen_:
```js
const query = 'query="We Will Rock You" AND arid:0383dadf-2a4e-4d10-a46a-e9e041da8eb3';
const query = 'query=artist:"Queen" AND release:"We Will Rock You"';
const result = await mbApi.search('release-group', {query});
```
Expand Down
7 changes: 7 additions & 0 deletions test/test-musicbrainz-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -687,6 +687,13 @@ describe('MusicBrainz-api', function () {

describe('Query', () => {

it('query: Queen - Made In Heaven', async () => {
const query = 'query=artist:"Queen" AND release:"Made in Heaven"';
const result = await mbApi.search('release-group', {query});
assert.isAtLeast(result.count, 1);
assert.strictEqual(result["release-groups"][0].id, '780e6a16-9384-307d-ae65-02e1d6313753');
});

it('query: Queen - We Will Rock You', async () => {
const query = 'query="We Will Rock You" AND arid:0383dadf-2a4e-4d10-a46a-e9e041da8eb3';
const result = await mbApi.search('release-group', {query});
Expand Down

0 comments on commit 48f3990

Please sign in to comment.