Pradeep,
The Library Services API provides a dls:documents-query() constructor 
<http://developer.marklogic.com/pubs/4.1/apidocs/dls-2.html#dls:documents-query>
 that limits a search to only the latest version of all managed documents. The 
Search API—upon which Application Builder-generated applications are 
built—provides an <additional-query> option 
<http://developer.marklogic.com/pubs/4.1/apidocs/SearchAPI.html#search:search>as
 a way to further constrain searches by “and”-ing the supplied query with the 
parsed search. Thus, you can limit searches with the Search API to the current 
version of managed document by specifying an additional-query option:

<options xmlns="http://marklogic.com/appservices/search";>
  <!-- other options here -->
  <additional-query>{dls:documents-query()}</additional-query>
</options>

This customization is not available from Application Builder’s user interface, 
though. You’ll have to edit /application/lib/config.xqy in your generated 
application to add the additional-query option to the two options nodes—one for 
the front page of the application and one for the search results.

Please see section 2.2 in the “Search Developer’s Guide” 
<http://developer.marklogic.com/pubs/4.1/books/search-dev-guide.pdf> for more 
information about search options and section 4 of the “Application Builder 
Developer’s Guide” 
<http://developer.marklogic.com/pubs/4.1/books/appbuilder.pdf> for information 
about extending Application Builder applications.

Along similar lines, you could also create a custom constraint in your Search 
API options to allow users to search for managed documents as of a given date 
using a dls:as-of-query. You could also “tag” a snapshot of managed documents 
with a collection—similar to a CVS or Subversion tag—and use a collection 
constraint in the Search API to limit searches to only that snapshot.

For more information on custom constraints with the Search API, please see 
section 2.5 of the “Search Developer’s Guide” 
<http://developer.marklogic.com/pubs/4.1/books/search-dev-guide.pdf>. For an 
example of a collection constraint, please take a look at section 2.2.2.3.

As always, please let me know if you have any other questions.

Justin

Justin Makeig
Product Manager
Mark Logic Corporation
999 Skyway Road
Suite 200
San Carlos, CA 94070
+1 650 655 2387 Phone
[email protected]<mailto:[email protected]>
www.marklogic.com<http://www.marklogic.com> 
<http://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]] On Behalf Of Pradeep Maddireddy
Sent: Thursday, July 09, 2009 7:22 AM
To: General Mark Logic Developer Discussion
Subject: [MarkLogic Dev General] Facet in Application builder to search latest 
version and all versions

Hi…!

  We are using versioning (Library manage services) to store multiple versions 
of a document in Marklogic Database. Can we create facets in application 
builder to search only the latest version or all versions.

Thanks
Pradeep Maddireddy

_______________________________________________
General mailing list
[email protected]
http://xqzone.com/mailman/listinfo/general

Reply via email to