MarkLogic Java API samples…

People often ask me about integrating with MarkLogic. Had an interesting one today from a partner asking for code for re-usable query terms. In this post I describe what I’ve created with links to the code…

I’ve created a Github repository here I intend to add information to with little gems of code samples:-

https://github.com/adamfowleruk/mljavasamples

These samples are linked to a sandbox REST server in MarkLogic. There are several provided:-

CreateCustomSearchOptions – Defines and persists to the server a named set of Search Options. These can be defined by an admin user (typically), or as search defaults by any user, and referred to in subsequent searches

CustomSearchOptions – Uses the search options along with a structured search (awesome API in V6!) to find all animals with a kingdom value of ‘bird’

GetDocumentElements – Uses XPath to extract specific nodes from a document on the server (saves a lot of DOM/SAX work)

GetDocumentProperties – Fetches a document’s properties document (also XML) and lists all properties. Also shows best practice in how to load a known, named property.

If you find these useful please let me know!

One comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.