Hi David,

Test with the following code , Its working for me . Here I created two 
collections "cdcollection" and "cd1collection" , and inserted sample CD xml 
file with range index for "TITLE" element in both collection with small changes 
in the TITLE value like 1.xml have "Empire" and 2.xml have "Empower". Then run 
the below mentioned query.

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";>
<default-suggestion-source>
   <range collation="http://marklogic.com/collation/";
          type="xs:string" facet="true">
      <element ns="" name="TITLE"/>
   </range>
</default-suggestion-source>
<additional-query>{cts:collection-query("cd1collection")}
  </additional-query>
</options>
return search:suggest("Emp",$options)

Thanks and regards
Raja >>>

From: general-boun...@developer.marklogic.com 
[mailto:general-boun...@developer.marklogic.com] On Behalf Of Steiner, David J. 
(LNG-DAY)
Sent: Wednesday, May 27, 2015 7:46 PM
To: MarkLogic Developer Discussion
Subject: Re: [MarkLogic Dev General] using collection and range in 
default-suggestion-source

Hi Raja,

This doesn't work.  I get the same result whether I specify collections that I 
want or collections that I don't want - as long as it is a valid collection or 
collections, I get the same result.

Thanks,
David

From: 
general-boun...@developer.marklogic.com<mailto:general-boun...@developer.marklogic.com>
 [mailto:general-boun...@developer.marklogic.com] On Behalf Of 
rajamani.marimu...@cognizant.com<mailto:rajamani.marimu...@cognizant.com>
Sent: Wednesday, May 27, 2015 8:59 AM
To: general@developer.marklogic.com<mailto:general@developer.marklogic.com>
Subject: Re: [MarkLogic Dev General] using collection and range in 
default-suggestion-source

Hi David ,

In your  search:suggest query , have option called $query as last parameter , 
there you can specify structured query for your collection requirement ,like

<query>
  <collection-query>
    <uri>reports</uri>
    <uri>analysis</uri>
  </collection-query>
</query>


Thanks and regards
Raja >>>

From: 
general-boun...@developer.marklogic.com<mailto:general-boun...@developer.marklogic.com>
 [mailto:general-boun...@developer.marklogic.com] On Behalf Of Steiner, David 
J. (LNG-DAY)
Sent: Wednesday, May 27, 2015 6:06 PM
To: MarkLogic Developer Discussion
Subject: [MarkLogic Dev General] using collection and range in 
default-suggestion-source

I'd like to restrict my suggestions based upon collections (1 to N) for a given 
range element.  I've tried adding <collection> element(s) to the options but 
once I add it, I get no results back.

This works:
<search:options xmlns="http://marklogic.com/appservices/search";>
<default-suggestion-source>
   <range collation="http://marklogic.com/collation/";
          type="xs:string" facet="true">
      <element ns="" name="name"/>
   </range>
</default-suggestion-source>
</search:options>

This does not:
<search:options xmlns="http://marklogic.com/appservices/search";>
<default-suggestion-source>
   <range collation="http://marklogic.com/collation/";
          type="xs:string" facet="true">
      <element ns="" name="name"/>
   </range>
  <collection>collection1</collection>
</default-suggestion-source>
</search:options>

The documentation says, "The default-suggestion-source element can have zero or 
more of the following child elements:
<collection>
...
<range>
...
<word>
...
<word>
..."

So, is it not possible to combine ranges and collections, or am I just not 
doing it correctly?

Thanks,
David
This e-mail and any files transmitted with it are for the sole use of the 
intended recipient(s) and may contain confidential and privileged information. 
If you are not the intended recipient(s), please reply to the sender and 
destroy all copies of the original message. Any unauthorized review, use, 
disclosure, dissemination, forwarding, printing or copying of this email, 
and/or any action taken in reliance on the contents of this e-mail is strictly 
prohibited and may be unlawful. Where permitted by applicable law, this e-mail 
and other e-mail communications sent to and from Cognizant e-mail addresses may 
be monitored.
This e-mail and any files transmitted with it are for the sole use of the 
intended recipient(s) and may contain confidential and privileged information. 
If you are not the intended recipient(s), please reply to the sender and 
destroy all copies of the original message. Any unauthorized review, use, 
disclosure, dissemination, forwarding, printing or copying of this email, 
and/or any action taken in reliance on the contents of this e-mail is strictly 
prohibited and may be unlawful. Where permitted by applicable law, this e-mail 
and other e-mail communications sent to and from Cognizant e-mail addresses may 
be monitored.
_______________________________________________
General mailing list
General@developer.marklogic.com
Manage your subscription at: 
http://developer.marklogic.com/mailman/listinfo/general

Reply via email to