I was trying to test adding my own search snippeting function using
the search:search API but ran into some trouble trying to use it in
cq. I was trying to keep the custom function in the same main module
as the search itself. I keep getting the error:

[1.0-ml] SEARCH-APPLYUNDEFINED: (err:FOER0000) Value of @apply
undefined: custom-snippet

Is there a trick to make this work in the same module in cq or does
the custom function have to be in a separate file with @ns and @at
defined?

The query is below.

Thanks!

xquery version "1.0-ml";
import module namespace
search="http://marklogic.com/appservices/search"; at
"/MarkLogic/appservices/search/search.xqy";

declare function local:custom-snippet(
  $result as node(),
  $ctsquery as schema-element(cts:query),
  $options as element(search:transform-results)?
) as element(search:snippet)
{
  (:search:snippet($result, $ctsquery, $options):)
  <search:snippet/>
};

search:search("blue",
  <options xmlns="http://marklogic.com/appservices/search";>
    (: I've tried multiple variations of this node :)
    <transform-results apply="custom-snippet"/>
  </options>
)
_______________________________________________
General mailing list
[email protected]
http://developer.marklogic.com/mailman/listinfo/general

Reply via email to