Welcome to the MarkLogic Server playground!

This tutorial gets you started writing queries against MarkLogic Server. We'll begin with some simple one-liner queries, progress to some modular programs, and along the way explore how to use XPath, XQuery, and MarkLogic's Search API.

We assume you know the basics. If you're truly brand new, you should probably jump out and find some introductory material, then come back.

All the sample code you'll see is live and you're invited to execute it as we go along. You can (and should) tweak it with your own changes. For a test data set, we've loaded roughly 5,000,000 emails that were copied over from the MarkMail.org site. Each email is represented by an XML document, and for mails that have attachments they're held in separate binary documents within the database with links in the main XML document.

We've placed the data on a single shared RackSpace virtualized machine. We're using security rules so you (as a public user) can read, but not write, to the database, and each query is allowed a maximum of 10 seconds to complete before it's forcibly killed.

You may want to refer to the API documentation as you follow along.

Lay of the Land

Comments

  • I have gone through a lot of programs of such types but after having 50 emails XML I just came to know that there is still a lot to know and that moment I realized that Internet is a sea and you learn new thing every time.
  • I even have been getting a lot of helpful and informative material in your web site.<a href="http://www.generalrecreationinc.com/outdoor-bleachers">outdoor aluminum bleachers</a>
  • Hello, this is fastidious post I actually loved reading this. <a href="http://buyrealfacebooklikess.postbit.com/">buy like</a>
  • Info is implausible, I would want to see more and more from your writers. <a href="http://www.sewamobils.sitew.org/#Page_1.A">sewa mobil</a>
  • I assume the admin of this website is truly working onerous in favor of his internet site, since here each data is quality based mostly. <a href="http://www.preciousinvitations.co.uk">wedding stationary</a>
  • Your blogs are easily accessible and quite enlightening so keep doing the amazing work guys. <a href="http://www.e-hrsoftware.com/2014/03/28/">wikipedia reference</a>
  • Living it up; living advertisement statesman n a lot more.<a href="http://angelospizza.us/bubblegumcasting-com-legitimate-reviews/">bubblegum casting reviews</a>
  • Great tutorial.
  • I am new to MarkLogic, but I know a bit of Xquery and this could potentially add to my DB portfolio.
  • All elements and attributes are indexed.  Some are indexed in specific ways beyond the defaults. 
    •  Does this mean that the "separate binary documents" mentioned of the attachments are also indexed?  Wouldn't this take up a lot of disk space?
      • They are stored.  We could extract and index their metadata, but have not done so for this sample.   MarkLogic can store binaries "internally in the database" and/or "externally outside of the database".  In this example, we are storing them in the database.  See http://docs.marklogic.com/5.0doc/docapp.xqy#display.xqy?fname=http://pubs/5.0doc/xml/dev_guide/binaries.xml for more details on binaries.
  • I would like to know what elements and/or attributes of the email xml  are indexed.