[Xesam] Recommended way to support/escape quotation marks in user search language?
Mikkel Kamstrup Erlandsen
mikkel.kamstrup at gmail.com
Sun Sep 28 11:32:38 PDT 2008
2008/9/25 Sandy Armstrong <sanfordarmstrong at gmail.com>:
> Hi Xesam Folks,
> Banshee currently uses a super-set of xesam for its user search
> language , but at the moment it does not support searching for
> quotation marks, which occasionally occur in album/artist/track names,
> etc. The Banshee devs suggested I ping you before working on any patch. :-)
> Is there any recommended way to represent a literal quotation mark in
> the user search language? Searching through the mailing list 
> brought up some ideas but nothing definitive.
> Here are the approaches I'm considering:
> Escape " as \"
> Escape " as ""
> Escape " as ''
> Treat ' in search language as ' or "
> Any ideas? Also, should this be part of the spec? If so, what's the
> best way for me to help get it added?
Sorry for the late reply but I have been on the road all weekend.
The main idea of the USL has been to try and do what users might
reasonably expect. That is base it on Spotlight and Google's query
languages. To be honest I can't figure out what rule they use. It
seems that it may just be "strip all single- and double quotes". This
might make sense on the web, but as you demonstrate might be bad on
I like your latter suggestion quite a lot - ie: Treat ' in search
language as ' or ". The good:
1) Easy to code on the server/parsing side
2) Doesn't introduce "collateral escape sequences" - fx if we use \"
we would have to escape \ as well (this sucks double since we support
regexes with the 'r' modifier)
3) Works even though the user can't remember if the string is single-
or double quoted
1) Users can't do exact matching. I personally don't care, but some
users are bound to complain
My biggest concern with this approach is actually whether this
solution is sufficient for your use case. As far as I can see it will
be, but you guys are really the experts here :-)
Do you have any more requirements or use cases from the Banshee camp?
Feedback from app developers is priceless.
More information about the Xesam