for $hit in doc("/db/shakespeare/plays/hamlet.xml")//SPEECH[ft:query(., "'nature'")]
let $expanded := kwic:expand($hit)
order by ft:score($hit) descending
return
    kwic:get-summary($expanded, ($expanded//exist:match)[1], <config width="40"/>,
        util:function(xs:QName("local:filter"), 2))