contains vs &= operator affect on match-count
Bug reported:
Search “culture” with no other criteria, one result is Hugues with 7 matches.
Search "culture" with location=Canada, one result is Hugues with 8 matches.
Problem is caused by use of "&=" operator. That exist operator causes the match to be included in the count of matches, which is not what I want. Could rejig a bunch of code so that only the matches on the text are counted, or could use the standard "contains" operator to filter returned nodes without affecting match-count. Latter is easier, so that's what I did.
Example before:
for $result in collection('francotoile/data')
//tei:TEI [tei:text/tei:body[. &= 'culture']]
[tei:teiHeader/tei:profileDesc/tei:particDesc/tei:person/tei:residence[ . &= "Canada"]]
order by text:match-count($result) descending
return ...
Example now:
for $result in collection('francotoile/data')
//tei:TEI [tei:text/tei:body[. &= 'culture']]
[tei:teiHeader/tei:profileDesc/tei:particDesc/tei:person/tei:residence[ contains (., "Canada")]]
order by text:match-count($result) descending
return ...
Thanks to Martin for clarifying this difference between the two operators.