[Bug 3439] MildNot using wrong position info and not extended to properly handle phrases

http://www.w3.org/Bugs/Public/show_bug.cgi?id=3439

           Summary: MildNot using wrong position info and not extended to
                    properly handle phrases
           Product: XPath / XQuery / XSLT
           Version: Working drafts
          Platform: PC
               URL: http://www.w3.org/TR/xquery-full-text/#ftmildnot
        OS/Version: Windows XP
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Full Text
        AssignedTo: jim.melton@acm.org
        ReportedBy: joaquin.delgado@oracle.com
         QAContact: public-qt-comments@w3.org


In the following function (ApplyFTMildNot) all occurences of @queryPos, which
is just the position of the token in the query, should be replaced by
fts:tokenInfo/@startPos which corresponds to the match position because that is
what is really being compared.

However I would argue that comparing the starting position (verifying that all
the matches "satisfies $pos1 ne $pos2") is not sufficient. Specially in cases
where the word that matches in the first allmatches is not the first word of
the phrase in the second allmatches or two phrases are the operands.

For example:

- FTSelection ("Ford" mildnot "Francis Ford Coppola")
- FTSelection ("Ford Mustang" mildnot "Ford Mustang Special Edition")

-----------------------------------------------------------------
declare function fts:ApplyFTMildNot (
      $allMatches1 as element(fts:allMatches),
      $allMatches2 as element(fts:allMatches) ) 
   as element(fts:allMatches)
{
   if (fn:count($allMatches2//fts:stringExclude) gt 0) then
      fn:error("Invalid expression on the right-hand side of a not-in")
   else
      <fts:allMatches stokenNum="{$allMatches1/@stokenNum}">
      {
         let $posSet2 := $allMatches2/fts:match/fts:stringInclude/@queryPos
         return 
            $allMatches1/fts:match[
               every $pos1 in ./fts:stringInclude/@queryPos, 
                     $pos2 in $posSet2
               satisfies $pos1 ne $pos2]
      }
      </fts:allMatches>
};

Received on Friday, 7 July 2006 16:33:07 UTC