Hi,

Is there a way to return all matches when searching a large XML structure? For example, return the genomic keywords that matched anywhere in $study using the following query:

for $study in db:open('CTGov')/clinical_study
let $result := $study contains text { 'genomics', 'genomic', 'transcriptome', 'exome', 'whole genome', 'microarray', 'proteome', 'metabolome' }
let score $score := $result
where $score >= 0.01
return $study/id_info/nct_id (: this is just the Study ID :)

Ideally it would include an indication of where in the tree the matches are (e.g., that ‘exome’ was found in $study/official_title and in $article/keywords).

This could presumably be done using regular expression matching (after serializing the tree into a text string) but it does not seem an elegant solution.

Thanks,
Ron