Hi Mihir,
The way the first argument of suggest works might not be what you're
expexting. The first string in the sequence is used to do the
suggestion pattern, and the rest of them are and-ed to to narrow down
the range of suggestions available to the first pattern.
So
search:suggest(("a-const:e","b-const:e"), $options,10)
Will return all the terms from a-const constraint that start with "e"
and also are in documents that are found by b-const:e (exactly). That's
probably not what you wanted to do. To get a list of values from
constraints, you might want to look at search:values (a relatively newer
search API function). With a call to values you can get a list of
matches from an index, optionally qualified by a subquery.
Hope that helps, let me know if I've misunderstood.
Charles
On 04/26/2013 03:21 AM, Mihir Das wrote:
Guys, Any suggestion?
Thanks!
-Mihir
On Thu, Apr 25, 2013 at 5:31 PM, Mihir Das <[email protected]> wrote:
Hi Guys,
I need some suggestion to tweak search:suggest for getting result-set from
two nodes. My sample query is mentioned below:
xquery version "1.0-ml";
import module namespace search = "http://marklogic.com/appservices/search"
at "/MarkLogic/appservices/search/search.xqy";
let $options :=
<options xmlns="http://marklogic.com/appservices/search">
<grammar>
<quotation>"</quotation>
<implicit>
<cts:or-query strength="10" xmlns:cts="http://marklogic.com/cts"/>
</implicit>
<joiner strength="50" apply="constraint">:</joiner>
</grammar>
<constraint name="b-const">
<range collation="http://marklogic.com/collation"
type="xs:string" facet="true">
<element ns="" name="b"/>
</range>
</constraint>
<suggestion-source ref="b-const">
<range collation="http://marklogic.com/collation"
type="xs:string" facet="true">
<element ns="" name="b"/>
</range>
</suggestion-source>
<constraint name="a-const">
<range collation="http://marklogic.com/collation"
type="xs:string" facet="true">
<element ns="" name="a"/>
</range>
</constraint>
<suggestion-source ref="a-const">
<range collation="http://marklogic.com/collation"
type="xs:string" facet="true">
<element ns="" name="a"/>
</range>
</suggestion-source>
</options>
return
search:suggest(("a-const:e","b-const:e"), $options,10)
Output: no results
ML version: 4.2
Expected output: OR-ing of result set matching the value "e*" from node
"a" & "b"
Thanks in advance!
-Mihir
_______________________________________________
General mailing list
[email protected]
http://developer.marklogic.com/mailman/listinfo/general
--
Charles Greer
Senior Engineer
MarkLogic Corporation
[email protected]
Phone: +1 707 408 3277
www.marklogic.com
_______________________________________________
General mailing list
[email protected]
http://developer.marklogic.com/mailman/listinfo/general