I am having a probkem with using near queries within not queries when
the queries are stored and used in a reverse query.

This fails, no matter how far apart "bad" and "word" are. The distance
value seems to be ignored. The query will not return the stored query
even if the words "bad" and "word" are hundreds of words apart.

let $XMLQuery :=
<cts:and-query xmlns:cts="http://marklogic.com/cts";>
  <cts:not-query>
    <cts:near-query distance="2">
      <cts:word-query><cts:text
xml:lang="en">bad</cts:text></cts:word-query>
      <cts:word-query><cts:text
xml:lang="en">word</cts:text></cts:word-query>
    </cts:near-query>
  </cts:not-query>
  <cts:or-query>
    <cts:word-query><cts:text
xml:lang="en">red</cts:text></cts:word-query>
    <cts:word-query><cts:text
xml:lang="en">yellow</cts:text></cts:word-query>
  </cts:or-query>
</cts:and-query>
let $File := xdmp:document-insert("test.xml",
<Query>{$XMLQuery}</Query>)
return
  ( )

 ;

let $XML := <X>this contains yellow, with a bad a a a a a a word.</X>
return
  cts:search( /Query, cts:reverse-query($XML))


But strangely, when I do something similar in memory, it works fine.
So this returns "true" as I would expect:

let $XMLQuery := ...
let $XML := <X>this contains yellow, with a bad a a a a a a word.</X>
return
  cts:contains(cts:query($XMLQuery), cts:reverse-query($XML))

And this returns "false", as I would also expect because the words are
close together, so should prevent the match...

  let $XML := <X>this contains yellow, with a bad a word.</X>


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

Reply via email to