Hi Colleen,

Thanks a lot for your reply.

It's a good solution no results if the search term is empty. But my case is, if 
AssestID is not supplied then no results by default.

How can I do that?

Regards,
Asit Nautiyal

From: [email protected] 
[mailto:[email protected]] On Behalf Of Colleen Whitney
Sent: Friday, February 15, 2013 5:25 AM
To: MarkLogic Developer Discussion
Subject: Re: [MarkLogic Dev General] How to restrict the default search of ML 6 
rest api's

Hi Asit,

Is it just in the case where AssetID is not supplied that you want no results 
by default, or is it that you want no results if the search term is empty?

If you want, by default, for searches to return nothing if there isn't a match, 
that's easy to do.

Modify the term element in your options so that it looks like:
<term apply="term">
  <empty apply="no-results"></empty>
</term>

Is that what you were looking for?


Colleen Whitney
MarkLogic Corporation

Phone +1 650 655 2366
email  [email protected]<mailto:[email protected]>
web    www.marklogic.com<http://www.marklogic.com>

This e-mail and any accompanying attachments are confidential. The information 
is intended solely for the use of the individual to whom it is addressed. Any 
review, disclosure, copying, distribution, or use of this e-mail communication 
by others is strictly prohibited. If you are not the intended recipient, please 
notify us immediately by returning this message to the sender and delete all 
copies. Thank you for your cooperation.

________________________________
From: 
[email protected]<mailto:[email protected]>
 [[email protected]] on behalf of 
[email protected]<mailto:[email protected]> 
[[email protected]]
Sent: Thursday, February 14, 2013 2:18 AM
To: [email protected]<mailto:[email protected]>
Subject: [MarkLogic Dev General] How to restrict the default search of ML 6 
rest api's
Hi,

How can I, restrict the default search of ML 6 rest API's?

I have created options custom-search.xml  file which contains constraint for 
AssestID, as below

<search:constraint name=" AssestID ">
    <search:custom facet="false">
      <search:parse apply="custom-query" ns="http://hmhpub.com/orgID"; 
at="/AssestID.xqy"/>
    </search:custom>
  </search:constraint>

Now, I want to hit below URL

http://localhost:9000/v1/search?q=reader  AND 
AssestID:1000&options=custom-search&format=xml&collection=Resource

Based on AssestID parameter in above search URL, I am calling my own xquery 
module AssestID.xqy ,where I am getting the resID (like id_1 , id_2) from 
database based on AssestID:1000 and manipulating the search query which gives 
me result from collection "Resource" with keyword "reader" AND "id_1" OR "id_2" 
and its working fine.

Now, I want, if I will not supply AssestID in search URL, it should return 
empty result. But currently it's not happing.
If I am not passing AssestID in the search URL it gives me the default search 
result with keyword "reader" from whole database.

So, here I want to restrict  ML 6 rest API's default search. How can I do that 
to achieve my goal??

Regards,
Asit Nautiyal
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.
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.
_______________________________________________
General mailing list
[email protected]
http://developer.marklogic.com/mailman/listinfo/general

Reply via email to