I guess based on Erik's suggestion, I need to embed the URI inside a
structured query.

Regards,
Danny


On Wed, Apr 1, 2015 at 12:37 PM, Danny Sinang <d.sin...@gmail.com> wrote:

> I'm developing an ML REST API search call that's supposed to return all
> documents with the given URI and with the attribute published="true" .
>
> I've got the search options node constraint for the published="true" part.
>
> So I was wondering how to add a constraint for the document URI.
>
> If I'm to use the additional-query option, how do I pass-in the URI
> parameter in the REST API search (GET) URL  ?
>
> Regards,
> Danny
>
>
>
> On Wed, Apr 1, 2015 at 11:56 AM, Erik Hennum <erik.hen...@marklogic.com>
> wrote:
>
>> Hi, Danny and Gregory:
>>
>> You can also use a search:document-query in the Search API without using
>> an additional query.
>>
>>     http://docs.marklogic.com/guide/search-dev/structured-query#id_27172
>>
>> What's the use case for defining a constraint for document URIs?  I
>> wouldn't expect users to type document uris into a search box or an
>> application to build facets over document URIs (which by definition have
>> one fragment per URI).
>>
>>
>> Erik Hennum
>>
>> ________________________________________
>> From: general-boun...@developer.marklogic.com [
>> general-boun...@developer.marklogic.com] on behalf of Murray, Gregory [
>> gregory.mur...@ptsem.edu]
>> Sent: Wednesday, April 01, 2015 8:47 AM
>> To: MarkLogic Developer Discussion
>> Subject: Re: [MarkLogic Dev General] search:search constraint for
>> document URI
>>
>> You can do this with cts:document-query() like so:
>>
>> (: Performs a search for the specified query text within the specified
>> document. :)
>> declare function m:document-search(
>>   $qtext as xs:string,
>>   $uri as xs:anyURI,
>>   $start as xs:unsignedLong?,
>>   $page-length as xs:unsignedLong?)
>> as element(search:response)
>> {
>>   let $options :=
>>     <options xmlns="http://marklogic.com/appservices/search";>
>>       <!-- limit the search to the specified document -->
>>       <additional-query>{cts:document-query($uri)}</additional-query>
>>     </options>
>>   return search:search($qtext, $options, $start, $page-length)
>> };
>>
>>
>> On Apr 1, 2015, at 11:06 AM, Danny Sinang wrote:
>>
>> > Is it possible to define a search:search constraint to match a document
>> URI without having to resort to writing/using a custom constraint ?
>> >
>> >
>> > Regards,
>> > Danny
>> >
>> > _______________________________________________
>> > General mailing list
>> > General@developer.marklogic.com
>> > Manage your subscription at:
>> > http://developer.marklogic.com/mailman/listinfo/general
>>
>> _______________________________________________
>> General mailing list
>> General@developer.marklogic.com
>> Manage your subscription at:
>> http://developer.marklogic.com/mailman/listinfo/general
>> _______________________________________________
>> General mailing list
>> General@developer.marklogic.com
>> Manage your subscription at:
>> http://developer.marklogic.com/mailman/listinfo/general
>>
>
>
_______________________________________________
General mailing list
General@developer.marklogic.com
Manage your subscription at: 
http://developer.marklogic.com/mailman/listinfo/general

Reply via email to