Hi Sai,

Taking a closer look at your code, your $query_string depends on two request 
parameters. Could there be something wrong with those? You fallback query is an 
empty string, you could try changing it to "*" that should return everything. 
(You might need to enable the wildcard index, though.)

Kind regards,
Geert

> -----Original Message-----
> From: [email protected] 
> [mailto:[email protected]] On Behalf Of 
> sai shanker
> Sent: dinsdag 29 september 2009 17:56
> To: General Mark Logic Developer Discussion
> Subject: RE: [MarkLogic Dev General] XQuery - working in cq 
> but not from code
> 
> Hi,
> I tried the suggestion below but didn't work. Well in the 
> same application i have another page where i am retrieving 
> and dispalying data from the database. that page works fine.
> Thanks,
> Sai.
> 
> --- On Tue, 9/29/09, Tim Meagher <[email protected]> wrote:
> 
> 
> 
>       From: Tim Meagher <[email protected]>
>       Subject: RE: [MarkLogic Dev General] XQuery - working 
> in cq but not from code
>       To: "'General Mark Logic Developer Discussion'" 
> <[email protected]>
>       Date: Tuesday, September 29, 2009, 11:48 AM
>       
>       
>       Hi Folks,
>       
>       Pardon me for piggy-backing on Geert's response.  I 
> lost the initial email.
>       
>       In my HTML apps I include the following line after the 
> XQuery declaration
>       and after any namespace and function declarations and 
> before the declaration
>       of any xquery variables and the construction of the html tags:
>       
>           xdmp:set-response-content-type("text/html"),
>       
>       Tim Meagher - AAOM Consulting
>       
>       
>       -----Original Message-----
>       From: [email protected] 
> <http://us.mc529.mail.yahoo.com/mc/compose?to=general-bounces@
> developer.marklogic.com> 
>       [mailto:[email protected] 
> <http://us.mc529.mail.yahoo.com/mc/compose?to=general-bounces@
> developer.marklogic.com> ] On Behalf Of Geert Josten
>       Sent: Tuesday, September 29, 2009 11:28 AM
>       To: General Mark Logic Developer Discussion
>       Subject: RE: [MarkLogic Dev General] XQuery - working 
> in cq but not from
>       code
>       
>       Hi Sai,
>       
>       There shouldn't be much difference from running code in 
> CQ compared to
>       running it from an xqy file. I suspect a configuration 
> error. Make sure your
>       xqy is running against the same database as you have 
> selected in CQ.
>       
>       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] 
> <http://us.mc529.mail.yahoo.com/mc/compose?to=general-bounces@
> developer.marklogic.com> 
>       > [mailto:[email protected] 
> <http://us.mc529.mail.yahoo.com/mc/compose?to=general-bounces@
> developer.marklogic.com> ] On Behalf Of
>       > sai shanker
>       > Sent: dinsdag 29 september 2009 16:00
>       > To: General Mark Logic Developer Discussion
>       > Subject: Re: [MarkLogic Dev General] XQuery - working in cq
>       > but not from code
>       >
>       > Hi Matt,
>       > I have tried the namespace that you suggested but it is
>       > giving me an error.
>       > Also i don't have namespace in my xml document that is why i
>       > am using *: wildcard namespace which is working fine without
>       > any error.
>       > <td align="left"> { $book/*:title/text()     } </td>
>       >
>       > What i am suspecting is  with the $query_string  variable is
>       > not getting substituted properly and hence the for is not
>       > returning any result.
>       > Thanks,
>       > Sai.
>       >
>       >
>       >
>       > --- On Tue, 9/29/09, Matt Corkum 
> <[email protected] 
> <http://us.mc529.mail.yahoo.com/mc/compose?to=m.cor...@elsevie
> r.com> > wrote:
>       >
>       >
>       >
>       >       From: Matt Corkum <[email protected] 
> <http://us.mc529.mail.yahoo.com/mc/[email protected]> >
>       >       Subject: Re: [MarkLogic Dev General] XQuery - working
>       > in cq but not from code
>       >       To: "General Mark Logic Developer Discussion"
>       > <[email protected] 
> <http://us.mc529.mail.yahoo.com/mc/compose?to=gene...@develope
> r.marklogic.com> >, [email protected] 
> <http://us.mc529.mail.yahoo.com/mc/compose?to=gene...@develope
> r.marklogic.com> 
>       >       Date: Tuesday, September 29, 2009, 9:41 AM
>       >
>       >
>       >       Hi Sai --
>       >
>       >       It may be namespaces then.
>       >
>       >       I do not see any default namespace declared in your
>       > xquery. Sometimes these help if you have no declared name
>       > space on your elements and functions.
>       >
>       >       default element namespace = ""
>       >       default function namespace = ""
>       >
>       >       take care --
>       >       Matt
>       >       At 09:28 AM 9/29/2009, sai shanker wrote:
>       >
>       >
>       >               Hi,
>       >               I am running into issues with a small code
>       > which executes perfectly fine in the cq but when it code to
>       > code it fails:-
>       >
>       >               my code  for search.xqy is mentioned below:-
>       >
>       > 
> =================================================================
>       >               <html xmlns=" http://www.w3.org/1999/xhtml
>       > <http://www.w3.org/1999/xhtml> ">
>       >               <head>
>       >               <title>Results</title>
>       >               </head>
>       >               <body>
>       >               <table>
>       >               {
>       >                       let $title := 
> xdmp:get-request-field("title")
>       >                       let $authorLast :=
>       > xdmp:get-request-field("authorLast")
>       >
>       >                       let $query_string := if ($title) then
>       > cts:element-query(xs:QName("title"),
>       >
>       >          cts:word-query(($title),("case-insensitive",
>       >
>       >                                           
> "diacritic-insensitive"))  )
>       >                      else
>       >                      (
>       >                                if ($authorLast) then
>       > cts:element-query(xs:QName("author"),
>       >
>       > cts:element-query(xs:QName("last"),
>       >
>       > cts:word-query(($authorLast),("case-insensitive",
>       >
>       >
>       > "diacritic-insensitive"))  ))
>       >                         else  ""
>       >
>       >                      )
>       >
>       >
>       >               for $book in cts:search(
>       > doc("myBooks.xml")/*:books/*:book,$query_string)
>       >               return
>       >               <tr>
>       >               <td align="left"> { 
> $book/*:title/text()     } </td>
>       >               <td align="left"> {
>       > $book/*:author/*:last/text()  } </td>
>       >               </tr>
>       >               }
>       >               </table>
>       >               </body>
>       >               </html>
>       >
>       > 
> ================================================================
>       >
>       >               Can you please help me ?
>       >
>       >               Thanks and Regards,
>       >               Sai.
>       >
>       >
>       >
>       >
>       >               _______________________________________________
>       >               General mailing list
>       >               [email protected] 
> <http://us.mc529.mail.yahoo.com/mc/compose?to=gene...@develope
> r.marklogic.com> 
>       >               http://xqzone.com/mailman/listinfo/general
>       >
>       >
>       >       -----Inline Attachment Follows-----
>       >
>       >
>       >       _______________________________________________
>       >       General mailing list
>       >       [email protected] 
> <http://us.mc529.mail.yahoo.com/mc/compose?to=gene...@develope
> r.marklogic.com> 
>       > <http://us.mc529.mail.yahoo.com/mc/compose?to=gene...@develope
>       > r.marklogic.com>
>       >       http://xqzone.com/mailman/listinfo/general
>       >
>       >
>       >
>       >
>       
>       _______________________________________________
>       General mailing list
>       [email protected] 
> <http://us.mc529.mail.yahoo.com/mc/compose?to=gene...@develope
> r.marklogic.com> 
>       http://xqzone.com/mailman/listinfo/general
>       
>       
>       _______________________________________________
>       General mailing list
>       [email protected] 
> <http://us.mc529.mail.yahoo.com/mc/compose?to=gene...@develope
> r.marklogic.com> 
>       http://xqzone.com/mailman/listinfo/general
>       
> 
> 
> _______________________________________________
General mailing list
[email protected]
http://xqzone.com/mailman/listinfo/general

Reply via email to