[r1696] ‘AND’ operator not working in XmlApi.

This topic contains 1 reply, has 2 voices, and was last updated by  jblache 7 years, 9 months ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #2914

    undertow
    Member

    As specified in the XmlApi documentation:

    You can OR two expresions with a comma (,), and AND two expressions with a plus (+).

    GET /databases/1/items?output=xml&query=’daap.songartist:Morrissey’,’daap.songartist:The Smiths’

    This would return all songs performed by The Smiths or by Morrissey.

    GET /databases/1/items?output=xml&query=’daap.songformat:mp3’+’daap.songbitrate+128′

    This would get all mp3s with a bitrate higher than 128Kb.

    However, when trying to perform a query with the AND (+) operator, it tosses an error and returns ALL of the items in the library.

    LOG OUTPUT:

    2009-06-01 12:09:44 (b4cffb90): Request: GET /databases/1/items?output=xml&query=’daap.songartist:Korn’+’daap.songalbum:Greatest%20Hits’ HTTP/1.1
    2009-06-01 12:09:44 (b4cffb90): Ignoring bad query (‘daap.songartist:Korn’ ‘daap.songalbum:Greatest Hits’): Offset 24: Expecting end of statement

    In contrast, the OR (-) operator functions correctly as expected.

    #18592

    jblache
    Participant

    @undertow wrote:

    However, when trying to perform a query with the AND (+) operator, it tosses an error and returns ALL of the items in the library.

    LOG OUTPUT:

    2009-06-01 12:09:44 (b4cffb90): Request: GET /databases/1/items?output=xml&query=’daap.songartist:Korn’+’daap.songalbum:Greatest%20Hits’ HTTP/1.1
    2009-06-01 12:09:44 (b4cffb90): Ignoring bad query (‘daap.songartist:Korn’ ‘daap.songalbum:Greatest Hits’): Offset 24: Expecting end of statement

    As the log shows, your + sign gets decoded to a space. + sign in the query string decodes to space, if you really mean a + sign you need to encode it. Try again with %2b instead of + in your request.

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.
Register here