W3C home > Mailing lists > Public > public-qt-comments@w3.org > June 2010

Re: [FT] ftnot of no matches

From: Michael Dyck <jmdyck@ibiblio.org>
Date: Tue, 08 Jun 2010 00:21:19 -0700
Message-ID: <4C0DEF6F.6080500@ibiblio.org>
To: public-qt-comments@w3.org
Paul J. Lucas wrote:
> In of the XQuery Full Text spec, the semantics seem clear enough.
> However, what's not clear is how ftnot works when there are no matches to begin with.
> Given:
> 	let $x := <msg>hello, world</msg>
> 	return $x contains text ftnot "goodbye"
> It's clear that the XML document does not contain "goodbye".
> Hence, the matchTokenInfos() function will return no TokenInfo objects and,
> subsequently, applyQueryTokensAsPhrase() will return an empty <allMatches/>.
> Calling ApplyFTUnaryNot() on <allMatches/> will do nothing since there are
> no stringIncludes to flip to stringExcludes and vice versa.

Not quite nothing. Note the first few lines of fts:UnaryNotHelper():

     if (fn:empty($matches))
     then <fts:match/>
     else ...

Thus, calling ApplyFTUnaryNot() on <allMatches/> yields

which will cause the FTContainsExpr to yield true, as you expect.

Received on Tuesday, 8 June 2010 07:28:18 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 16:57:31 UTC