Thanks Gary , this works.

-----Original Message-----
From: [email protected] 
[mailto:[email protected]] On Behalf Of Gary Vidal
Sent: Wednesday, November 20, 2013 5:00 PM
To: [email protected]
Subject: Re: [MarkLogic Dev General] Highlighting query

Pragya,

If you want full phrase matches where longest string match wins then you will 
probably want to sort each term in length order and iterate over each phrase or 
word and highlight like noted except with may just constructed elements.   But 
he order in which you execute them will be the difference.  So if you highlight 
terms longest to shortest then you have better chance to match longer terms 
over shorter terms.

In your highlight function you may want to check if the node you are 
highlighting has already been highlighted by looking at the cts:node variable 
and stepping up the ancestor path like below.


 if(fn:exists($cts:node/ancestor-or-self::html:span)) then 
<html:span>{$cts:text}</html:span> else $cts:text 
_______________________________________________
General mailing list
[email protected]
http://developer.marklogic.com/mailman/listinfo/general

**************** CAUTION - Disclaimer *****************
This e-mail contains PRIVILEGED AND CONFIDENTIAL INFORMATION intended solely 
for the use of the addressee(s). If you are not the intended recipient, please 
notify the sender by e-mail and delete the original message. Further, you are 
not 
to copy, disclose, or distribute this e-mail or its contents to any other 
person and 
any such actions are unlawful. This e-mail may contain viruses. Infosys has 
taken 
every reasonable precaution to minimize this risk, but is not liable for any 
damage 
you may sustain as a result of any virus in this e-mail. You should carry out 
your 
own virus checks before opening the e-mail or attachment. Infosys reserves the 
right to monitor and review the content of all messages sent to or from this 
e-mail 
address. Messages sent to or from this e-mail address may be stored on the 
Infosys e-mail system.
***INFOSYS******** End of Disclaimer ********INFOSYS***
_______________________________________________
General mailing list
[email protected]
http://developer.marklogic.com/mailman/listinfo/general

Reply via email to