Pragya, search:suggest() is designed to return strings from a particular range
index or lexicon; I don't think you can accomplish exactly what you want to do
with this API call.
________________________________________
From: [email protected]
[[email protected]] On Behalf Of Pragya Kapoor
[[email protected]]
Sent: Thursday, May 13, 2010 3:38 AM
To: [email protected]; [email protected]
Subject: [MarkLogic Dev General] Query Suggestions with search:suggest
Hi,
I have query regarding the suggestions.
I need to get suggestions from element <a> but have to return <a> along with
<b> element values.
What needs to be added to achieve it in below code.
Code:
xquery version "1.0-ml";
let $query := "year"
let $dummy := xdmp:log (("In main"),"info")
let $options :=
<options xmlns="http://marklogic.com/appservices/search">
<constraint name="test">
<range collation="http://marklogic.com/collation/"
type="xs:string" facet="false">
<element ns="" name="a"/>
</range>
</constraint>
<suggestion-source ref="test" >
<range collation="http://marklogic.com/collation/"
type="xs:string" facet="false">
<element ns="" name="a"/>
</range>
</suggestion-source>
</options>
let $finalquery := fn:concat("test:", $query)
let $suggestions := search:suggest($finalquery, $options)
return
$suggestions
Sample data:
- < <id="123">
< <a>......</a>
< <b>.......</b>
</id>
<id="234">
< <a>........</a>
< <b>.........</b>
</id>
Also my dataset is very large so need to see the performance also
Thanks
Pragya
_______________________________________________
General mailing list
[email protected]
http://developer.marklogic.com/mailman/listinfo/general