Thanks by the info. The upgrade from 3.x to 4.2 was quite hard. We had to run tres updates and to write code for using search function. Un saludo, Mariano Grau mgrau @ grupojoly.com Dpto. Sistemas Grupo Joly
________________________________ De: general-boun...@developer.marklogic.com [mailto:general-boun...@developer.marklogic.com] En nombre de Danny Sokolsky Enviado el: viernes, 14 de junio de 2013 23:14 Para: MarkLogic Developer Discussion Asunto: Re: [MarkLogic Dev General] Queryfor searchingdocuments witha null node If you plan on upgrading to 5, I would consider going straight to 6 (current release is 6.0-3.2). You should be able to skip 5, just test your apps on 6. The upgrade to 6 supports going directly from 4.2. Then you would only have to reindex once. That is likely why our results are not the same, but it could also be because of index options you have. -Danny From: general-boun...@developer.marklogic.com [mailto:general-boun...@developer.marklogic.com] On Behalf Of Mariano Grau Calín Sent: Friday, June 14, 2013 2:09 PM To: MarkLogic Developer Discussion Subject: Re: [MarkLogic Dev General] Query for searchingdocuments witha null node I am using 4.2-7 and know we must upgrade at least 5.0. Mariano Grau mgrau @ grupojoly.com Dpto. Sistemas Grupo Joly ________________________________ De: general-boun...@developer.marklogic.com [mailto:general-boun...@developer.marklogic.com] En nombre de Danny Sokolsky Enviado el: viernes, 14 de junio de 2013 22:19 Para: MarkLogic Developer Discussion Asunto: Re: [MarkLogic Dev General] Query for searchingdocuments witha null node What version of MarkLogic are you using? For me on 6.0-3.2, it works: xquery version "1.0-ml"; xdmp:document-insert("/test.xml", <doc> <published> <pub>spain</pub> </published> <published> <pub>france</pub> <section>tv</section> </published> </doc> ); <xpath>{/doc[published[pub/string() eq "spain"][not(section)]]}</xpath>, <search>{ cts:search(/doc, cts:element-query(xs:QName("published"), cts:and-not-query( cts:element-value-query(xs:QName("pub"), "spain"), cts:element-value-query(xs:QName("section"), "*" ) ) ) ) }</search> => <xpath> <doc> <published> <pub>spain</pub> </published> <published> <pub>france</pub> <section>tv</section> </published> </doc> </xpath> <search> <doc> <published> <pub>spain</pub> </published> <published> <pub>france</pub> <section>tv</section> </published> </doc> </search> From: general-boun...@developer.marklogic.com [mailto:general-boun...@developer.marklogic.com] On Behalf Of Mariano Grau Calín Sent: Friday, June 14, 2013 12:32 PM To: MarkLogic Developer Discussion Subject: Re: [MarkLogic Dev General] Query for searching documents witha null node The * character does not validate any value in my queries. It looking for a node that is exactly that character. Also i tried replacing cts:element-value-query(xs:QName("section"), "*" ) by cts:element-query(xs:QName("section"), cts:and-query(())) but without success. It seems than when looks for a null evaluates all nodes. Thanks, Mariano Grau mgrau @ grupojoly.com Dpto. Sistemas Grupo Joly ________________________________ De: general-boun...@developer.marklogic.com [mailto:general-boun...@developer.marklogic.com] En nombre de Danny Sokolsky Enviado el: jueves, 13 de junio de 2013 18:45 Para: MarkLogic Developer Discussion Asunto: Re: [MarkLogic Dev General] Query for searching documents witha null node Hi Mariano, I think I figured out how to do this using cts:query. Try this: cts:search(/doc, cts:element-query(xs:QName("published"), cts:and-not-query( cts:element-value-query(xs:QName("pub"), "spain"), cts:element-value-query(xs:QName("section"), "*" ) ) ) ) This works because an element-value-query for * matches any value, and negating it ends up matching no value. Give that a try. -Danny From: general-boun...@developer.marklogic.com [mailto:general-boun...@developer.marklogic.com] On Behalf Of Mariano Grau Calín Sent: Thursday, June 13, 2013 9:19 AM To: MarkLogic Developer Discussion Subject: Re: [MarkLogic Dev General] Query for searching documents with a null node It seems that my query is near. All we need to restrict the search of null nodes to published nodes with pub equal to a value. I am using search:search() function and do not know as to integrate xpath in it. Thanks, Mariano Grau mgrau @ grupojoly.com Dpto. Sistemas Grupo Joly ________________________________ De: general-boun...@developer.marklogic.com [mailto:general-boun...@developer.marklogic.com] En nombre de Danny Sokolsky Enviado el: jueves, 13 de junio de 2013 2:15 Para: MarkLogic Developer Discussion Asunto: Re: [MarkLogic Dev General] Query for searching documents with a null node I do not know of a way to express that as a cts:query. The problem is that it is hard to search for a combination of something that is there and something that is not there. If you don't care about relevance order, you can do this in an xpath as follows: /doc[published[pub/string() eq "spain"][not(section)]] Someone might be able to come up with a clever way to do this in a cts:query, but I cannot think of one. -Danny From: general-boun...@developer.marklogic.com [mailto:general-boun...@developer.marklogic.com] On Behalf Of Mariano Grau Calín Sent: Wednesday, June 12, 2013 2:44 PM To: general@developer.marklogic.com Subject: [MarkLogic Dev General] Query for searching documents with a null node Hello all! Our users are asking us a query to find documents like these: <doc> <published> <pub>spain</pub> </published> <published> <pub>france</pub> <section>tv</section> </published> </doc> where pub node is equal to spain and section node is null in published node. We unsuccessfully tried this query: cts:search(/doc, cts:element-query( xs:QName("published"), cts:and-query( (cts:element-value-query(xs:QName("pub"), "spain") ,cts:not-query(cts:element-query(xs:QName("section"), cts:and-query(()) ))) ) ) ) The document above not match this query because contain one node with section equal to 'tv'. How should construct the query to obtain documents as the order? Thanks, Mariano Grau mgrau @ grupojoly.com Dpto. Sistemas Grupo Joly
_______________________________________________ General mailing list General@developer.marklogic.com http://developer.marklogic.com/mailman/listinfo/general