Hi,

I have a question on how to add the custom constraint into application built
by app-builder.

 

By referring to
http://adamfowlerml.wordpress.com/2012/10/22/adding-search-synonyms/ and
http://docs.marklogic.com/guide/app-builder/wizard#id_61168

 

1.       I have created a thesaurus library named as "Lib-thesaurus.xqy" as
below and uploaded it into the root path (X:\ after mapped in window) of my
application via WebDav.

----------------------------------------------------------------------------
------------------------------------

Lib-thesaurus.xqy

----------------------------------------------------------------------------
-------------------------------------

xquery version "1.0-ml";

module namespace facet="http://marklogic.com/xdmp/thesaurus";;

import module namespace search = "http://marklogic.com/appservices/search";
at "/MarkLogic/appservices/search/search.xqy";

import module namespace thsr="http://marklogic.com/xdmp/thesaurus"; at
"/MarkLogic/thesaurus.xqy";

 

declare function facet:parse(

$constraint-qtext as xs:string,

$right as schema-element(cts:query))

as schema-element(cts:query)

{

let $term := fn:string($right//cts:text)

return

let $th := thsr:expand(

cts:word-query($term),

thsr:lookup("/1Gov/thesaurus.xml", $term),

0.25,

(),

() )

return

<root>{cts:or-query((cts:word-query($term),$th))}</root>/*

};

----------------------------------------------------------------------------
------------------------------------

 

2.       I have also added this custom constraint line in the Edit Custom
XML Option on Application Builder as below.

----------------------------------------------------------------------------
------------------------------------

Edit Custom XML Option on Application Builder (at Search Tab)

----------------------------------------------------------------------------
------------------------------------

<annotation xmlns="http://marklogic.com/appservices/search";>

<constraint name="thes">

<custom facet="false">

<parse apply="parse" ns="http://marklogic.com/xdmp/thesaurus";
at="lib-thesaurus1.xqy" />

</custom>

</constraint>

</annotation>

 

But I don't see the thesaurus is working on my application.

 

Can anybody please help to point out where I miss out?

a.       Am I uploaded the thesaurus-lib to the right place?

b.      How can I invoke the thesaurus constraint?

 

Thanks.

 

cheers,

SC

 

_______________________________________________
General mailing list
[email protected]
http://developer.marklogic.com/mailman/listinfo/general

Reply via email to