Dear Christian,
thanks a lot for your help. Now I have lots of stuff to think about and to implement.
Best, Günter
Am 04.01.2016 um 02:29 schrieb Christian Grün christian.gruen@gmail.com:
By the way, here are two more rewritings to avoid the current sliding of the let clause:
Variant A: for $city in doc('factbook')//city/name let $hits := ft:mark($city[text() contains text 'paris']) where $hits let $name := $city/ancestor::country/name return ($hits, $name)
Variant B: for $city in doc('factbook')//city/name for $hits in ft:mark($city[text() contains text 'paris']) return let $name := $city/ancestor::country/name return ($hits, $name)
And here is one more programmatic way to specify full-text options only once in the query:
let $ft := map { 'wildcards': true() } let $terms := 'pa.*' for $city in ft:search('factbook', $terms, $ft)/ parent::name[ancestor::city] let $hits := ft:mark($city[ft:contains(text(), $terms, $ft)]) return let $name := $city/ancestor::country/name return ($hits, $name)
This variant is clearly the most verbose one, but it may turn out to be the favorite once you want to specify a lot more full-text options more than once.
On Sun, Jan 3, 2016 at 12:44 PM, Christian Grün christian.gruen@gmail.com wrote:
let $query := "Paris" for $city in doc('factbook')//city/name[text() contains text {$query}] return ft:mark($city)
doesn't return the 'mark'-tags
Sorry, should have been like that:
let $query := "Paris" for $city in doc('factbook')//city/name[text() contains text {$query}] return ft:mark($city[text() contains text {$query}])