We use exist-db base for storing various xml documents, on which we perform searches using xquery. This is example of xml document:
<person personID="some_id">
<name>
<familyName>Doe</familyName>
<firstName>John</firstName>
</name>
</person>
The search we are using is fuzzy search, and the query is in following form
xquery version "3.0";
for $doc in collection('/db/Persons')/*[ft:query(.,'milan~')]
let $score := ft:score($doc)
order by $score descending return base-uri($doc)
The problem is that search orders results rather strange. For example, it ranks Milun, Milun, Golan, Vilon before Milan. In other words, search assigns greater score to the results that are not exact match compared to the exact match ( Milan ). What are we doing wrong? Is there a way for exact matches to have higher scores compared to near-exact matches?