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:

Next »Lay of the Land

Comments

  • 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.