Yes, I think that's an accurate description of the implemented behavior, as far as it goes. XQYSP isn't intended to have a programmable grammar like search:parse does. I don't believe one parser can be all things to all people. But here's what https://github.com/mblakele/xqysp says about this:
> If the syntax isn't exactly what you need, this could make a nice template > for your own search parser. Patches are also welcome. > > The test cases use XQUT. If you find problems, please provide a test case. So if you want different behavior, I suggest you write a patch that implements what you want. If you push it to a github fork and create a pull request, I will be happy to consider it. If you think someone else might do the work for you, you could create a feature request at https://github.com/mblakele/xqysp/issues. At a bare minimum that should include one or more test cases that express the behavior you want, and exclude behavior that you don't want. -- Mike On 10 Dec 2012, at 04:36 , Abhishek53 S <[email protected]> wrote: > > 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 _______________________________________________ General mailing list [email protected] http://developer.marklogic.com/mailman/listinfo/general
