not containsText wrong result

declare namespace tf = “http://namespaces.softwareag.com/tamino/TaminoFunction
(for $q in input()/NEWCRIM
where not( tf:containsText($q/TFATTO/COM , ‘FIRENZE’) )
return $q)

the above query doesn’t return any records, but the next returns the correct result:

declare namespace tf = “http://namespaces.softwareag.com/tamino/TaminoFunction
(for $q in input()/NEWCRIM
where not( $q/TFATTO/COM = ‘FIRENZE’ )
return $q)

This happens with every xml element.

Does somebody knows why?

thanx, Paolo

Hi Paolo,
Depending of course on the content of the TFATTO/COM element of course.
But if this is a text element that contains a lot of words among which FIRENZE may be alone or just one of many words, then a “NOT containsText” will reject all documents where firenze is the full or just part of the element.
Compare this to the “NOT equals” in the second query, where only documents that contain the EXACT text “FIRENZE” are rejected.

But from my point of view there would be a greater chance of elements being returned from the last query, because less documents are rejected.

  • exactly what you get ?!

Or have I missed some important point ?
Finn

Sorry I don’t specify that the element TFATTO/COM may contain only one word (‘FIRENZE’, ‘ROMA’, ‘MILANO’ …) and the containText operation without NOT returns the expected results, as well as the equal operation.

But I don’t understand what happens with NOT.

I’m not sure I understand what you mean ?!
The second query will only give you a match if “FIRENCE” and ONLY “FIRENCE” is the full content of the TFATTO/COM element.
So does the second query without NOT give you what you expect ?
Finn

Sorry for my bad english :oops:.
Well the element TFATTO/COM contains only one word for each record so the containText and the equal operations give me the same values if arguments are the same.

So does the second query without NOT give you what you expect ?
yes, the returned result is what I expect.

But the “not containsText” doesn’t work as I need, it doesn’t find any record.

I tried the same queries with a simpler xml than the previous and all work as I expect.

I actually don’t understand

Thanx for replies :slight_smile:

Hi,

could you please send an XML document that is leads to teh unexpected query result?