Hi Andrew,

Can you provide the whole query, including the options node and the input, that 
exhibits this behavior?  It seems to work for me.

Also, what version of MarkLogic Server are you running (i.e., what is the 
output of xdmp:version() ).

Also, you might just use the snippets that the search API returns by default 
(in the search:snippet node of the search:response output).  They include the 
highlighted terms.

-Danny

-----Original Message-----
From: [email protected] 
[mailto:[email protected]] On Behalf Of Andrew Welch
Sent: Monday, December 21, 2009 3:40 AM
To: General Mark Logic Developer Discussion
Subject: Re: [MarkLogic Dev General] cts:highlight using the query from 
theqtext area of the search:response

Thanks Geert,

That's what I needed :)  This is is working well now:

cts:highlight($input, cts:query(search:parse($qtext)), <span
class="highlight">{$cts:text}</span>)

however when the $qtext contains a facet, such as "hello AND foo:bar"
I get this:

XDMP-NONMIXEDCOMPLEXCONT: data(<cts:and-query qtextjoin="AND"
strength="20" xmlns:cts="http://marklogic.com/cts";><cts:word-query
qtextref="cts:text"><cts:text>sample</cts:text><...</cts:and-query>)
-- Node has complex type with non-mixed complex content

any ideas?

thanks


2009/12/21 Geert Josten <[email protected]>:
> Hi Andrew,
>
> You should be able to use search:parse to convert your search string into a 
> cts:query..
>
> Kind regards,
> Geert
>
>> Given a query like "hello AND foo:bar" how I can use
>> cts:highlight to highlight the results in the document itself?
>>
>> I use the search api (search:search) to run the initial
>> search, and would like to highlight the page after the user
>> has clicked through from one of the results (passing the the
>> uri and the search:response//search:qtext through to the next page)
>>
>> cts:highlight expects a cts:query as the 2nd argument, but to
>> create that it seems I would need to deconstruct "hello AND
>> foo:bar" into a cts:and-query... is that the only approach?
>>
>> thanks
>> andrew
>
>
>
> Drs. G.P.H. Josten
> Consultant
>
>
> http://www.daidalos.nl/
> Daidalos BV
> Source of Innovation
> Hoekeindsehof 1-4
> 2665 JZ Bleiswijk
> Tel.: +31 (0) 10 850 1200
> Fax: +31 (0) 10 850 1199
> http://www.daidalos.nl/
> KvK 27164984
> De informatie - verzonden in of met dit emailbericht - is afkomstig van 
> Daidalos BV en is uitsluitend bestemd voor de geadresseerde. Indien u dit 
> bericht onbedoeld hebt ontvangen, verzoeken wij u het te verwijderen. Aan dit 
> bericht kunnen geen rechten worden ontleend.
>
>
>
> _______________________________________________
> General mailing list
> [email protected]
> http://xqzone.com/mailman/listinfo/general
>



-- 
Andrew Welch
http://andrewjwelch.com
Kernow: http://kernowforsaxon.sf.net/
_______________________________________________
General mailing list
[email protected]
http://xqzone.com/mailman/listinfo/general
_______________________________________________
General mailing list
[email protected]
http://xqzone.com/mailman/listinfo/general

Reply via email to