You are right Mike!

It looks like my understanding was wrong. XQYSP supports parenthesis 
precedence but it ignores query strength like. AND has higher strength 
over OR then XQYSP will ignore the strength and provide parse using left 
precedence - Any suggestion 

Thanks
Abhishek Srivastav
Tata Consultancy Services
Cell:- +91-9883389968
Mailto: [email protected]
Website: http://www.tcs.com
____________________________________________
Experience certainty.   IT Services
                        Business Solutions
                        Outsourcing
____________________________________________



From:
Michael Blakeley <[email protected]>
To:
MarkLogic Developer Discussion <[email protected]>
Date:
12/10/2012 06:27 AM
Subject:
Re: [MarkLogic Dev General] XQYSP and parenthesis precedence
Sent by:
[email protected]



Where did you get that understanding? https://github.com/mblakele/xqysp 
mentions groups and shows parens as part of the grammar.

> Recently I needed to parse a fairly sophisticated search syntax for a 
project. I needed a pure XQuery solution, and MarkLogic's built-in search 
API wouldn't handle some of the syntax: nested groups, for example. So I 
wrote another one.

...
> L ::= expr*
> expr ::= group | infixExpr | term
> group ::= prefixOp? '(' expr* ')'
> ...


Still in doubt? Construct a test. Here's one.

import module namespace p="com.blakeley.xqysp" at "xqysp.xqy";

p:parse(
  '(alpha
      OR (beta AND X=(gamma))
      OR (delta))
    AND fubar')
=>
<root xmlns="com.blakeley.xqysp">
  <expression op="AND" type="infix">
    <expression op="OR" type="infix">
      <literal>alpha</literal>
      <expression op="AND" type="infix">
                 <literal>beta</literal>
                 <field name="X" op="=">
                   <literal>gamma</literal>
                 </field>
      </expression>
      <literal>delta</literal>
    </expression>
    <literal>fubar</literal>
  </expression>
</root>

-- Mike

On 9 Dec 2012, at 09:41 , Abhishek53 S <[email protected]> wrote:

> Hi All,
> 
> As per my understanding XQYSP completely ignores parenthesis [Applying 
precedence to query] so all the query will be parsed from left to right 
precedence.
> 
> Do we have any suggestion on how/where to change query to consider 
parenthesis as precedence.
> Thanks in advance!!!
> 
> Abhishek Srivastav
> Tata Consultancy Services
> Cell:- +91-9883389968
> Mailto: [email protected]
> Website: http://www.tcs.com
> ____________________________________________
> Experience certainty. IT Services
> Business Solutions
> Outsourcing
> =====-----=====-----=====
> Notice: The information contained in this e-mail
> message and/or attachments to it may contain 
> confidential or privileged information. If you are 
> not the intended recipient, any dissemination, use, 
> review, distribution, printing or copying of the 
> information contained in this e-mail message 
> and/or attachments to it are strictly prohibited. If 
> you have received this communication in error, 
> please notify us by reply e-mail or telephone and 
> immediately and permanently delete the message 
> and any attachments. Thank you
> 
> 
> _______________________________________________
> General mailing list
> [email protected]
> http://developer.marklogic.com/mailman/listinfo/general

_______________________________________________
General mailing list
[email protected]
http://developer.marklogic.com/mailman/listinfo/general


_______________________________________________
General mailing list
[email protected]
http://developer.marklogic.com/mailman/listinfo/general

Reply via email to