Hi Colleen,

Can you reproduce my problem?

Bob

-----Original Message-----
From: Runstein, Robert E. (Contr) (IS) 
Sent: Monday, March 01, 2010 7:59 AM
To: 'General Mark Logic Developer Discussion'
Subject: re:Cannot wrap cts:element-attribute-word-query in
cts:element-query

Hi Colleen,

I just upgraded to 4-1.5 and get the same error.

Bob
------------------------------------------------------------
Bob, I think you're running into a bug that was fixed in 4.1-5; if you
upgrade and still see this behavior, please let us know immediately.
________________________________________
From: [email protected]
[[email protected]] On Behalf Of Runstein, Robert
E. (Contr) (IS) [[email protected]]
Sent: Friday, February 26, 2010 1:00 PM
To: General Mark Logic Developer Discussion
Subject: [MarkLogic Dev General] Cannot wrap
cts:element-attribute-word-query in cts:element-query

Hi All,

It appears that cts:element-query does not support a nested
cts:element-attribute-word-query without an accompanying cts:word-query
when passed to search:resolve.  Using version 4.1-3.
Given the following document:
<doc><a><b attr="bob"/></a></doc>

The search:
let $q :=
<q>
<cts:element-query>
<cts:element>doc</cts:element>
<cts:element-query>
<cts:element>a</cts:element>
<cts:element-attribute-word-query>
<cts:element>b</cts:element>
<cts:attribute>attr</cts:attribute>
<cts:text xml:lang="en">bob</cts:text>
</cts:element-attribute-word-query>
</cts:element-query>
</cts:element-query>
</q>

return search:resolve($q/element())

==>

[1.0-ml] XDMP-INVQUERY: cts:query(<cts:element-query
xmlns:cts="http://marklogic.com/cts";><cts:element>doc</cts:element></cts
:element-query>) -- Invalid query: /cts:element-query

Stack trace:

in /MarkLogic/appservices/search/snippet.xqy line 63:
snip:do-highlight-element(fn:doc("/bob-attribute")/doc, (),
xs:positiveInteger("4"), xs:positiveInteger("30"),
xs:positiveInteger("200"), <cts:element-query
xmlns:cts="http://marklogic.com/cts";><cts:element>doc</cts:element></cts
:element-query>)


Wrapping the cts:element-attribute-word-query in a cts:or-query
containing an empty cts:word-query allows the query to succeed:

let $q :=
<q>
<cts:element-query>
<cts:element>doc</cts:element>
<cts:element-query>
<cts:element>a</cts:element>
<cts:or-query>
<cts:word-query/>
<cts:element-attribute-word-query>
<cts:element>b</cts:element>
<cts:attribute>attr</cts:attribute>
<cts:text xml:lang="en">bob</cts:text>
</cts:element-attribute-word-query>
</cts:or-query>
</cts:element-query>
</cts:element-query>
</q>


return search:resolve($q/element())

==>

<search:response total="1" start="1" page-length="10"
xmlns:search="http://marklogic.com/appservices/search";>
  <search:result index="1" uri="/bob-attribute"
path="fn:doc(&quot;/bob-attribute&quot;)" score="128"
confidence="0.675869" fitness="0.675869">
    <search:snippet>
      <search:match path="fn:doc(&quot;/bob-attribute&quot;)/doc"/>
    </search:snippet>
  </search:result>
  <search:metrics>

<search:query-resolution-time>PT0.015S</search:query-resolution-time>
    <search:facet-resolution-time>PT0S</search:facet-resolution-time>

<search:snippet-resolution-time>PT0S</search:snippet-resolution-time>
    <search:total-time>PT0.015S</search:total-time>
  </search:metrics>
</search:response>

Looks like a bug?

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

Reply via email to