[FT] QueryItem & QueryTokenInfo

Hi there -

From the XQuery and XPath Full Text 1.0 specification, section 4.1.2:

> A QueryTokenInfo is the identity of a token inside a query string.

I interpret that to mean that if I were to have a query like:

	$x contains text "web site"

that there would be 2 QueryTokenInfo objects:

	QTI-1: word="web", queryPos=1
	QTI-2: word="site", queryPos=2

Also from the spec:

> A QueryItem is a sequence of QueryTokenInfos representing the collection of tokens derived from tokenizing one query string.

Continuing with the example, I interpret that to mean that I would have 1 QueryItem for the above:

	QI: { {word="web", queryPos=1}, {word="site", queryPos=2} }

Hence, for a given query, there would be at most 1 QueryItem ever.  If that's correct, then why in section 4.2.2 does the schema definition for ftWords:

>   <xs:complexType name="ftWords">
>     <xs:sequence>
>       <xs:element ref="fts:queryItem" 
>                   minOccurs="0" 
>                   maxOccurs="unbounded"/>
>     </xs:sequence>
>     <xs:attribute name="type" 
>                   type="fts:ftWordsType" 
>                   use="required"/>
>   </xs:complexType>

have a maxOccurs="unbounded"?  When would there every be more than one QueryItem for a query?  What does it mean for there to be, say, 2 QueryItems for a query?

In particular, for the implementation of fts:ApplyFTWordsAny() in section 4.2.4 where in part it does:

      let $firstQueryItem := $queryItems[1]
      let $restQueryItem := fn:subsequence($queryItems, 2)

do?  Again, if my query is "web site" and I have a single QueryItem for that, then for what query would $restQueryItem ever be anything that isn't null?

- Paul

Received on Tuesday, 25 May 2010 06:53:11 UTC