问题
i am doing a cts:element-attribute-range-query
and the results from it is working fine. But highlighting is not working for the output result. When i referred the search guide
http://developer.marklogic.com/pubs/4.2/books/search-dev-guide.pdf
i could see that cts:element-attribute-*-query
outputs will not be suitable for cts:highlight
function. I am using Marklogic 4.2. My application greatly depends on this highlighted output, Is there any way i can highlight the result output of cts:element-attribute-range query
?
回答1:
You could try cts:walk
instead of cts:highlight
. During the walk, look for nodes where cts:contains
returns true for the attribute portion of your query. Then you can highlight those nodes using whatever mechanism you like.
http://developer.marklogic.com/pubs/4.2/apidocs/SearchBuiltins.html#cts:walk has examples.
来源:https://stackoverflow.com/questions/9259253/marklogic-highlighting-ctselement-attribute-range-query-output