Adding this path as searchable expressión return empty sequence.
It looks as if search scope apply all document and not in published-node.
cts:search(/doc/published,
cts:element-query(xs:QName("published"),
cts:and-query((
cts:element-value-query(xs:QName("pub"), "london")
,cts:not-query(cts:element-query(xs:QName("section"), cts:and-query(())
))))
)
)
Regards,
Mariano Grau
mgrau @ grupojoly.com
Dpto. Sistemas
Grupo Joly
-----Mensaje original-----
De: [email protected]
[mailto:[email protected]] En nombre de Geert Josten
Enviado el: martes, 12 de noviembre de 2013 14:55
Para: MarkLogic Developer Discussion
Asunto: Re: [MarkLogic Dev General] Rewrite xpath code in cts:search()
Hi Mariano,
Taking a closer look I notice that your XPath is returning published nodes,
where the search is /doc based. Try using /doc/published as searchable
expression.
Kind regards,
Geert
> -----Oorspronkelijk bericht-----
> Van: [email protected] [mailto:general-
> [email protected]] Namens Mariano Grau Calín
> Verzonden: dinsdag 12 november 2013 13:00
> Aan: MarkLogic Developer Discussion
> Onderwerp: Re: [MarkLogic Dev General] Rewrite xpath code in
cts:search()
>
> I tried this query:
>
> cts:search(/doc,
> cts:element-query(xs:QName("published"),
> cts:and-query((
> cts:element-value-query(xs:QName("pub"), "london")
> ,cts:not-query(cts:element-query(xs:QName("section"),
cts:and-query(())
> ))))
> )
> )
>
> And get empty sequence.
> However, document #2 has a pub-node equal to london and not section-
> node (in a published node).
>
>
>
> Mariano Grau
> Dpto. Sistemas
> Grupo Joly
>
>
>
> -----Mensaje original-----
> De: [email protected] en nombre de Geert Josten
> Enviado el: mar 12/11/2013 11:13
> Para: MarkLogic Developer Discussion
> Asunto: Re: [MarkLogic Dev General] Rewrite xpath code in cts:search()
>
> Rewrite xpath code in cts:search()
>
> Hi Mariano,
>
>
>
> If you search for "*", then you ask for values with that exist. Try
> replacing it with section value-query by an element-query with
> cts:and-query(()) as sub-query..
>
>
>
> Kind regards,
>
> Geert
>
>
>
> *Van:* [email protected] [mailto:
> [email protected]] *Namens *Mariano Grau Calín
> *Verzonden:* dinsdag 12 november 2013 9:52
> *Aan:* [email protected]
> *Onderwerp:* [MarkLogic Dev General] Rewrite xpath code in
> cts:search()
>
>
>
> Hi all.
>
> Given this two documents:
>
> <doc>
> <published>
> <pub>madrid</pub>
> </published>
> </doc>
>
> <doc>
> <published>
> <pub>madrid</pub>
> <section>sport</section>
> </published>
> <published>
> <pub>london</pub>
> </published>
> </doc>
>
> This code returns document #2:
>
> doc()/doc/published[pub='london' and not(section)]
>
> If i run the next cts:search() code:
>
> cts:search(/doc,
> cts:element-query(xs:QName("published"),
> cts:and-query((
> cts:element-value-query(xs:QName("pub"), "london")
> ,cts:not-query(cts:element-value-query(xs:QName("section"), "*"
))))
> )
> )
>
> Get 'your query returned an empty sequence'.
> However, if change 'london' by 'madrid' get document #1.
>
> The target is to search documents where published-node contain
> pub-node and not section-node.
>
> Thanks,
>
> Mariano Grau
> Dpto. Sistemas
> Grupo Joly
_______________________________________________
General mailing list
[email protected]
http://developer.marklogic.com/mailman/listinfo/general
_______________________________________________
General mailing list
[email protected]
http://developer.marklogic.com/mailman/listinfo/general