Re: [MarkLogic Dev General] search:search - escaping quotes

2012-03-21 Thread Majid Valipour
Hi,

AFAIK the builtin search parser does not have an escaping mechanism (but it
should!). A more flexible alternative parser can be found here:
https://github.com/mblakele/xqysp

If you choose to ignore  ' and  from user input instead of escaping them,
here are two easy solutions:
 1- Remove ' and  from your query before passing it to search:parse
 2- Add  punctuation-insensitive to your search term options which causes '
 to be ignored. Note: make sure to change the default grammar to use a
different character from  for its quotation operator.

Best regards,
Majid Valipour
Scholars Portal

On 20 March 2012 18:45, Ryan Dew ryan.j@gmail.com wrote:

 With the default setting you shouldn't have to worry about escaping single
 quotes. Search is flexible in that with the search:options element you can
 pass options that modify the grammar. Unfortunately/fortunately, depending
 of your view of things, the parser doesn't accommodate the use of regular
 expression patterns in the grammar, so I don't think there is a simple
 solution.

 Your best bet may be to do your own parsing to create a cts:query and use
 search:resolve. This isn't an ideal solution. When I have time I'd like to
 look into it further.

 -Ryan Dew


 On Tue, Mar 20, 2012 at 9:03 AM, Danny Sinang d.sin...@gmail.com wrote:

 Hi,

 In search:search(), how do I escape single and double quotes entered by
 the user ?

 Regards,
 Danny



 ___
 General mailing list
 General@developer.marklogic.com
 http://developer.marklogic.com/mailman/listinfo/general



 ___
 General mailing list
 General@developer.marklogic.com
 http://developer.marklogic.com/mailman/listinfo/general


___
General mailing list
General@developer.marklogic.com
http://developer.marklogic.com/mailman/listinfo/general


Re: [MarkLogic Dev General] search:search - escaping quotes

2012-03-20 Thread Ryan Dew
With the default setting you shouldn't have to worry about escaping single
quotes. Search is flexible in that with the search:options element you can
pass options that modify the grammar. Unfortunately/fortunately, depending
of your view of things, the parser doesn't accommodate the use of regular
expression patterns in the grammar, so I don't think there is a simple
solution.

Your best bet may be to do your own parsing to create a cts:query and use
search:resolve. This isn't an ideal solution. When I have time I'd like to
look into it further.

-Ryan Dew


On Tue, Mar 20, 2012 at 9:03 AM, Danny Sinang d.sin...@gmail.com wrote:

 Hi,

 In search:search(), how do I escape single and double quotes entered by
 the user ?

 Regards,
 Danny



 ___
 General mailing list
 General@developer.marklogic.com
 http://developer.marklogic.com/mailman/listinfo/general


___
General mailing list
General@developer.marklogic.com
http://developer.marklogic.com/mailman/listinfo/general