Hi all, Thanks for your help. There is a precedence from right to left. ie, (((AnyField:"test" AND AnyField:"test2") OR Anyfield:"test3" )NOT AnyField:"test4") for the query search:parse('((AnyField:"test" AND AnyField:"test1" )"-" AnyField:"test2" ) OR AnyField:"test3"') we get the output <cts:or-query qtextjoin="OR" strength="10"> - <cts:and-query strength="20"> - <cts:and-query qtextjoin="AND" strength="20"> - <cts:word-query qtextpre="AnyField:"" qtextref="cts:text" qtextpost="""> <cts:text>test</cts:text> </cts:word-query> - <cts:word-query qtextpre="AnyField:"" qtextref="cts:text" qtextpost="""> <cts:text>test1</cts:text> </cts:word-query> </cts:and-query> - <cts:and-query strength="20"> - <cts:word-query qtextpre=""" qtextref="cts:text" qtextpost="""> <cts:text>-</cts:text> </cts:word-query> - <cts:word-query qtextpre="AnyField:"" qtextref="cts:text" qtextpost="""> <cts:text>test2</cts:text> </cts:word-query> </cts:and-query> </cts:and-query> - <cts:word-query qtextpre="AnyField:"" qtextref="cts:text" qtextpost="""> <cts:text>test3</cts:text> </cts:word-query> </cts:or-query> so i am not getting expected results with the precedence. So please tell me how to achieve this.
Regards Ambika On Mon, May 2, 2011 at 5:06 PM, seme...@hotmail.com <seme...@hotmail.com>wrote: > Seems like you could get the functionality you want just using the default > grammar of search:search. > > Just make the search phrase be: "test AND test2 OR test 3 AND -test4" > > By default using "AND" and "OR" in capitals does boolean logic in > search:search and the "-" does a "NOT" condition. I'd try that first to see > if it gets you what you want. > > ------------------------------ > Date: Mon, 2 May 2011 13:37:08 +0530 > From: ambikaarumuga...@gmail.com > To: general@developer.marklogic.com > > Subject: [MarkLogic Dev General] Reg: Advanced search query formation > > Hi all, > I am working with an advanced search functionality in which i have to > search against anyfield in a xml and the input for it is > 'AnyField:"test" AND AnyField:"test2" OR Anyfield:"test3" NOT > AnyField:"test4"'. > I would like to get the results in a such a way that, should return the > documents which has element values "test" and "test2" may be "test3" and > should not contain "test4". > > From my understanding i can use word-query with cts:and-query,cts:or-query > and cts:not-query combination's. But i would like to know how to split the > input string to form the query for different and,or and not > combinations.There can be any number AnyField: combinations as an input. > > Please suggest how to get this done. > > Thanks in advance, > Ambika > > _______________________________________________ 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