Hi Sini,

I'm not sure I understand fully what you're looking for, because I'd also reach for a collection constraint.

Let's say you have a collection constraint and have named it "X" and it has prefix "/my/collections/"

<options>
  <constraint name="X">
    <collection prefix="/my/collections"/>
  </constraint>
</options>

Then if you include X:hotels in a search string, only documents from the "/my/collections/hotels" will be returned. If you put a facets="false" attribute on the collection element

<options>
  <constraint name="X" facet="false">
    <collection prefix="/my/collections"/>
  </constraint>
</options>

If you want this kind of filter on for all results, you'll want to make a cts:query and include it in an <additional-query/> element using "Custom XML Options":


<additional-query xmlns="http:/marklogic.com/appservices/search">
 <cts:collection-query xmlns:cts="http://marklogic.com/cts";>
    <cts:uri>reports</cts:uri>
    <cts:uri>analysis</cts:uri>
  </cts:collection-query>
</additional-query>

Hope that helps,
Charles


On 12/13/2012 02:17 AM, sini narayanan wrote:
Hi All,

While building an application using App.Builder, how do I filter the
documents in my database based on a particular collection?
For example I have documents under three different collections (Hotel,
Restaurant, Hotel_Restaurant). I need to create an application which would
query only in the Hotel_Restaurant collection. How do I do this?
I tried the collection contraint. But this would create facets of different
collection that I have in the DB and then I'll have to filter collections
from the Application which I dont want.
Please help.

Thanks,
Sini



_______________________________________________
General mailing list
General@developer.marklogic.com
http://developer.marklogic.com/mailman/listinfo/general


--
Charles Greer
Senior Engineer
MarkLogic Corporation
charles.gr...@marklogic.com
Phone: +1 707 408 3277
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.

_______________________________________________
General mailing list
General@developer.marklogic.com
http://developer.marklogic.com/mailman/listinfo/general

Reply via email to