Hi,
I have placed small document in database with enabled full-text index: <text> Text with hello world phrase. </text>
The following expression: ft:mark(db:open('simple')//*[text() contains text 'hello world'])
produces: <text>Text with <mark>hello</mark> <mark>world</mark> phrase.</text>
Is it possible to enclose result in one element <mark>hello world</mark> ?
Regards Bartosz Marciniak
Hi Bartosz,
Is it possible to enclose result in one element <mark>hello world</mark> ?
unfortunately this is not possible, because at the stage of marking the terms, we don’t have any information if the matched terms were the result of a single or phrase search. If all of your adjacent query terms will be the result of phrase queries, you could rewrite your result with some additional XQuery code (using e.g. a transform expression [1]).
Hope this helps, Christian
On Fri, 2013-04-19 at 11:25 +0200, Bartosz Marciniak wrote:
Is it possible to enclose result in one element <mark>hello world</mark> ?
In general this is not possible using XQuery and XPath Full Text 1.0, and it's the single most-requested feature for a future version.
Many vendors provide an extension to do "match highlighting" including BaseX:
http://docs.basex.org/wiki/Full-Text_Module
Liam
basex-talk@mailman.uni-konstanz.de