Hi,
I've done a bit of research, here's the result (which completely contradicts what albertsj1 has stated, I'm afraid). It would definitely be helpful if someone in the know could pipe up at some point
backgroundThe API call relies on a lucene backend to index and retrieve results
http://subsonic.svn.sourceforge.net/viewvc/subsonic/trunk/subsonic-main/src/main/java/net/sourceforge/subsonic/service/LuceneSearchService.java?revision=2409&view=markup.
The query parameter should be a valid lucene query. I've had some success following this documentation
http://lucene.apache.org/java/2_4_0/queryparsersyntax.html#GroupingThe other parameters (*Count, *Offset) are simply used for paging the results.
in practiceSo queries can be structured like this (path/standard parameters omitted, param values not encoded for readability):
Get 10 songs with index entries starting with 'e':
- Code: Select all
?query=e*&songCount=10&artistCount=0&albumCount=0
Get 10 artists whose names start with 'a' OR 'z':
- Code: Select all
?query=a* OR z*&songCount=10&artistCount=0&albumCount=0
Note that artistCount and albumCount are explicitly set to 0 in these examples, because we want ONLY songs. The default values for those parameters are 20 (subsonic api docs).
I haven't found a way to:
- query all artists/song/albums (no way to specify 'unlimited' in the *Count parameters, no way to start the query parameter with a wildcard (as stated in lucene doc)
- send queries like "
So it seems this is really an api call suited for full text searching, and not at all for listing data of various types.
I have come up with the following hack as a solution for the "all artists" query problem like so (javascript):
- Code: Select all
var letters = 'abcdefghijklmnopqrstuvwxyz';
var query = letters.split('').join('* OR ') + '*';
// api is just an object I wrote for querying the api
api.search2({query: query, artist: 'a', artistCount: 1000000, songCount: 0, albumCount: 0});
Not satisfactory, really...
