>> The following code works in the Query Console but does not work in my xQuery 
>> application.

What is your application? (What library/program etc)
­The results shown look correct for the first return

You are returning a sequence of sequences which will flatten to a single long 
sequence.
Some XQuery APIs' dont handle sequence results ( or do not using the most basic 
interface).






-----------------------------------------------------------------------------
David Lee
Lead Engineer
MarkLogic Corporation
[email protected]
Phone: +1 812-482-5224
Cell:  +1 812-630-7622
www.marklogic.com<http://www.marklogic.com/>

From: [email protected] 
[mailto:[email protected]] On Behalf Of Javier Lizarraga
Sent: Tuesday, December 08, 2015 8:06 PM
To: MarkLogic Developer Discussion <[email protected]>
Subject: Re: [MarkLogic Dev General] simple xQuery Web Application

Hello David,

Related question...

I am having issues accessing an element attribute in search:facet...

The following code works in the Query Console but does not work in my xQuery 
application.

let $emp := search:search("(Bachala OR Chakka OR Kompelly OR Lasseter)", 
$options)
for $employees in $emp/search:facet/search:facet-value
let $fullname := $employees/text()
let $entries  := $employees/@count
return ($fullname, $entries, $emp)

==>

Vishnu Bell

47
<search:response snippet-format="empty-snippet" total="91" start="1" 
page-length="100" xmlns:search="http://marklogic.com/appservices/search";>
<search:facet name="FULL_NAME" type="xs:string">
<search:facet-value name="Vishnu Bell" count="47">
Vishnu Bell
</search:facet-value>
<search:facet-value name="Bala Bell" count="36">
Bala Bell
</search:facet-value>
<search:facet-value name="Stephen Bell" count="8">
Stephen Bell
</search:facet-value>
</search:facet>
<search:qtext>
(Bachala OR Chakka OR Kompelly OR Lasseter)
</search:qtext>
</search:response>

Advice would be greatly appreciated.

Javier

From: 
[email protected]<mailto:[email protected]>
 [mailto:[email protected]] On Behalf Of David Lee
Sent: Thursday, December 3, 2015 11:51 AM
To: MarkLogic Developer Discussion 
<[email protected]<mailto:[email protected]>>
Subject: Re: [MarkLogic Dev General] simple xQuery Web Application

Thanks that works.  So, the * is saying any namespace.

Yes,   (as of XPath 2.0)
/element  == element in no namepace
/*:element == element in any namepace

Very useful for quick 'one off's when you dont want to bother with the 
neamespace decl,
but its a bad habbit to get into for production code -- you can end up 
selecting elements in unexpected places
that you didnt intend.


-----------------------------------------------------------------------------
David Lee
Lead Engineer
MarkLogic Corporation
[email protected]<mailto:[email protected]>
Phone: +1 812-482-5224
Cell:  +1 812-630-7622
www.marklogic.com<http://www.marklogic.com/>


_______________________________________________
General mailing list
[email protected]
Manage your subscription at: 
http://developer.marklogic.com/mailman/listinfo/general

Reply via email to