Hi Ashwini,

Have you tried what you suggested? I see no objections. Though you will have to 
supply $field from externally somehow. Perhaps through request parameters?

Kind regards,
Geert

>


Drs. G.P.H. Josten
Consultant


http://www.daidalos.nl/
Daidalos BV
Source of Innovation
Hoekeindsehof 1-4
2665 JZ Bleiswijk
Tel.: +31 (0) 10 850 1200
Fax: +31 (0) 10 850 1199
http://www.daidalos.nl/
KvK 27164984
De informatie - verzonden in of met dit emailbericht - is afkomstig van 
Daidalos BV en is uitsluitend bestemd voor de geadresseerde. Indien u dit 
bericht onbedoeld hebt ontvangen, verzoeken wij u het te verwijderen. Aan dit 
bericht kunnen geen rechten worden ontleend.


> From: [email protected]
> [mailto:[email protected]] On Behalf Of Ashwini
> Sent: maandag 12 oktober 2009 7:50
> To: [email protected]
> Subject: [MarkLogic Dev General] I want to use a query like
> QName($field) in the element-query()
>
> Hello All,
>
> I am doing hands on Marklogic where in i am using MLS4.1 and
> trying to use cts:search against a set of documents in my
> database which are loaded using
>
> xdmp:document-load("C:\check\
>
> book1.xml",
>    <options xmlns="xdmp:document-load">
>       <uri>/documents/book1</uri>
>       <permissions>{xdmp:default-permissions()}</permissions>
>       <repair>full</repair>
>       <forests>
>         <forest>{xdmp:forest("myPoc")}</forest>
>       </forests>
>    </options> ),
>    xdmp:document-load("C:\check\book2.xml",
>        <options xmlns="xdmp:document-load">
>           <uri>/documents/book2</uri>
>           <permissions>{xdmp:default-permissions()}</permissions>
>           <repair>full</repair>
>           <forests>
>             <forest>{xdmp:forest("myPoc")}</forest>
>           </forests>
>    </options> )
>
> structure most of the xml documents is as follows:
>
>
> <?xml version="1.0" encoding="UTF-8"?>
> <books>
>    <book year="2001">
>        <title>Human Anatomy</title>
>        <author><first>Wesley</first><last>Martini</last></author>
>        <publisher>Addison-Wesley</publisher>
>        <price>139.00</price>
>    </book>
> </books>
> now when i am trying to run following cts:search query
> against the database, cts:search(collection()//descendant::books,
> cts:element-value-query(QName("title"), "Human", ("wildcarded",
> "case-insensitive")))
>
> this query working fine.
>
> but my requirement of search is dynamic.
> i.e., here i don't know which field i need to search, so i
> want to use a query like QName($field) in the above search.
>
>
>
> can anybody suggest me where i am going wrong.
>
> Looking forward to response.
> _______________________________________________
> General mailing list
> [email protected]
> http://xqzone.com/mailman/listinfo/general
>

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

Reply via email to