[XQuery] problem with the character "-"

Hi,

I have this XQuery:


declare namespace tf='http://namespaces.softwareag.com/tamino/TaminoFunction' for $Person in (input()/Person/Name[/Person/Name/Firstname[tf:containsText(., 'e-a')]])[position() > 0 and position() <= 1000] return <Persons Name={$Person/Name/Lastname}>{$Person/Firstname}</Persons> sort by (@Name)

Like result, there are:


<Firstname>Pierre-Alain</Firstname>
<Firstname>Line ally</Firstname>
<Firstname>Janeat</Firstname>

Normally, I would like to have like result, only Pierre-Alain

Is anyone know how I can do this!

Thank you very much for your help!

C

Hi Cedric,

in this query, there are a lot of issues:

  1. your filter is not relative (it starts with a /). Expected:
    input()/Person/Name[Firstname[…]]

  2. your filter selects person names, not firstnames. If a person has multiple firstnames, you will see them all, if one of them matches the ccondition. You probably want something like
    for $firstname in (input()/Person/Name/Firstname[tf:containsText(…)]) …

  3. are you sure there is an attribute @Name in Element Name. Otherwise, your sort will fail

  4. most probably Pierre-Alain is part of the result only by chance, because it does not match the condition tf:containsText(., ‘e-a’). tf:cointainsText is NOT a substring function, but is based on tokens, i.e. handles whole words. You probably want to use the function contains

Regards

Harald

Hi Harald,

I follow your advices 1) and 2) and I modify my Xquery like thhis:


declare namespace tf='http://namespaces.softwareag.com/tamino/TaminoFunction' for $Person in (input()/Person/Name/Firstname[tf:containsText(., 'e-a')])[position() > 0 and position() <= 1000] return <Persons Name={$Person}>{$Person}</Persons> sort by (@Name)

But the result is always the same, It doesn’t resolve my problem.


<Firstname>Pierre-Alain</Firstname> 
<Firstname>Line ally</Firstname> 
<Firstname>Janeat</Firstname> 

For me, I seem that Tamino considers “tf:containsText(., ‘e-a’)” like “tf:containsText(., ‘ea’)” or “tf:containsText(., ‘e a’)”. I would like to know how I can do that Tamino consider the character ‘-’ like a normal character like a,b,c,…

Is anyone know how I can do this!

Thank you very much, for your heslp!

C

Hi Cedric,

I still wonder how you get these results. Could you please send the data?

The answer to your question on the handling of “-” is buried in the follwoing documentation section:
file:///C:/Program%20Files/Software%20AG/Tamino/Tamino%204.4.1.1/Documentation/en/unicode/unicode.htm#char-representation

I can give you more hints how to configure when I see your data

regards

Harald

Hi Harald,

I give you the real query, that you can test on the database you downloaded there were two weeks ago on http://www.powernet.ch/ftp/zefix.zip ([XQuery] Tamino Error - ino:returnValue: 8599 …)

The xquery is:


declare namespace tf='http://namespaces.softwareag.com/tamino/TaminoFunction' for $Zefix in (input()/Zefix/Search[SearchAIM[tf:containsText(., 'a-b')]])[position() > 0 and position() <= 1000] return <ZefixFound Hauptfassung={$Zefix/Found/FirmaSort}>{$Zefix/Found}</ZefixFound> sort by (@Hauptfassung)

Or I tried this other xquery


declare namespace tf='http://namespaces.softwareag.com/tamino/TaminoFunction' for $Zefix in (input()/Zefix/Search/SearchAIM[tf:containsText(., 'a-b')])[position() > 0 and position() <= 1000] return <ZefixFound Hauptfassung={$Zefix}>{$Zefix}</ZefixFound> sort by (@Hauptfassung)

In these two cases, we have the same result! It seems that the character ‘-’ is ignored by Tamino.

Which is the best way to resolve this problem?

Thank you for your help!

Regards

C

Hi Cedric,

yes, as documented in the documentation section I mentioned in my last reply, the “-” is ignored by Tamino by default. You can change this behaviour by modifying the document in collection ino:vocabulary doctype ino:transliteration. Change
<ino:character ino:class=“ignore” ino:value=“-”></ino:character>
to
<ino:character ino:class=“character” ino:value=“-”></ino:character>

and recreate the text indexes
Then, your query will retrieve only documents containing the WORD a-b,
e.g.
_ benvenue a - b _ benvenue a-b _
If you want to find documents which contain the STRING a-b, you have to ask for tf:conainsText(.,“a-b”). In this case, you should turn the word fragment index on

Regards

Harald

Hi Harald,

thank you for your help, now the query gives me the good answer with the character “-”.

Regards

C