2.4 Creating a Custom Constraint
<constraint name="my-custom">
<custom facet="true"><!-- or false -->
<parse apply="parse"ns="..." at="..." />
<start-facet apply="start"ns="..." at="..." />
<finish-facet apply="finish"ns="..." at="..." />
</custom>
</constraint>
从以上Custom constraint工作的内容上可以看出,它可以用于自定义语法解析apply=”parse”,可以用来处理facet信息。
2.4.1 Implementing the parse Function
declare function geoexample:parse(
$constraint-qtext as xs:string,
$right as schema-element(cts:query))
as schema-element(cts:query)
说白了就是自定义一个语法parse,其中你可以将querystring转换为你要的cts:query。
2.4.2 Implementing the start/finish-facet Function
declare function my-namespace:start-facet(
$constraint as element(search:constraint),
$query as cts:query?,
$facet-options as xs:string*,
$quality-weight as xs:double?,
$forests as xs:unsignedLong*)
as item()*
说白了就是自定义一个lexicon API用于统计facet的数据(数量)