How to search "AND" instead of "OR"

Forum to discuss MonkeyTunes DACP Server for MediaMonkey

How to search "AND" instead of "OR"

Postby fanguad » Tue Feb 17, 2015 10:53 am

I am writing some code to interface with MonkeyTunes and am having trouble figuring out how to do a search for one specific thing rather than all similar things. I am searching for a track based on Title, Artist and Album but I get all tracks with that name, artist OR album instead. My query looks like this

/databases/.../items?session-id=...&meta=...&type=music&sort=name&include-sort-headers=1&query=(('dmap.itemname:SongTitle','daap.songartist:SongArtist','daap.songalbum:AlbumName'))

I've also tried formatting it like so with the same results:
query=(('dmap.itemname:SongTitle')+('daap.songartist:SongArtist')+('daap.songalbum:AlbumName'))

What's going on under the hood on the server side, and how can I make MonkeyTunes give me a single result?
fanguad
 
Posts: 6
Joined: Tue Feb 17, 2015 10:44 am

Re: How to search "AND" instead of "OR"

Postby Melloware » Wed Feb 18, 2015 11:29 am

Ahh unfortunately our code then takes your query and hits the MM database to return results. It is using SQL LIKE '%yoursearch%" to return all like results not exact match results.

If you have Monkeytunes in DEBUG mode you will see each SQL Statement in the monkeytunes.log file that is generated from each of your queries.
=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Melloware Inc.
http://www.melloware.com
=-=-=-=-=-=-=-=-=-=-=-=-=-=-
User avatar
Melloware
Site Admin
 
Posts: 11062
Joined: Thu Dec 01, 2005 10:24 pm
Location: Philadelphia, Pennsylvania USA

Re: How to search "AND" instead of "OR"

Postby fanguad » Wed Feb 18, 2015 12:49 pm

I see that my DACP query below is translated into the following:

SELECT Songs.* FROM Songs WHERE Songs.SongTitle LIKE 'SongTitle' OR Songs.Artist LIKE 'SongArtist' OR Songs.Album LIKE 'AlbumName' ORDER BY Songs.Artist

It's not using % (which is great for me), but it is using OR to connect the clauses. Is there any way to rephrase my DACP query so I can get something like the following?

SELECT Songs.* FROM Songs WHERE Songs.SongTitle LIKE 'SongTitle' AND Songs.Artist LIKE 'SongArtist' AND Songs.Album LIKE 'AlbumName' ORDER BY Songs.Artist
fanguad
 
Posts: 6
Joined: Tue Feb 17, 2015 10:44 am

Re: How to search "AND" instead of "OR"

Postby Melloware » Wed Feb 18, 2015 1:09 pm

ahhh it looks like i have the OR's hardwired in. It was probably to help how the Apple Remote asks for data to make sure I could return the max results to the iPhone.

Because I think this same query is used by the "Search" feature on the Apple Remote where you can say "Hello" and it will find all artists, songs, and albums with Hello in it.
=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Melloware Inc.
http://www.melloware.com
=-=-=-=-=-=-=-=-=-=-=-=-=-=-
User avatar
Melloware
Site Admin
 
Posts: 11062
Joined: Thu Dec 01, 2005 10:24 pm
Location: Philadelphia, Pennsylvania USA

Re: How to search "AND" instead of "OR"

Postby fanguad » Wed Feb 18, 2015 1:35 pm

So, no way to tweak the DACP query on my end?
fanguad
 
Posts: 6
Joined: Tue Feb 17, 2015 10:44 am

Re: How to search "AND" instead of "OR"

Postby Melloware » Wed Feb 18, 2015 1:41 pm

fanguad wrote:So, no way to tweak the DACP query on my end?


Not currently, no matter what it OR's the artist, album, and track part of the query.
=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Melloware Inc.
http://www.melloware.com
=-=-=-=-=-=-=-=-=-=-=-=-=-=-
User avatar
Melloware
Site Admin
 
Posts: 11062
Joined: Thu Dec 01, 2005 10:24 pm
Location: Philadelphia, Pennsylvania USA

Re: How to search "AND" instead of "OR"

Postby fanguad » Wed Feb 18, 2015 2:04 pm

Ok, thanks for that info. I'll do client-side filtering and cross my fingers for an eventual update.
fanguad
 
Posts: 6
Joined: Tue Feb 17, 2015 10:44 am


Return to MonkeyTunes for MediaMonkey

Who is online

Users browsing this forum: Google [Bot] and 1 guest

cron