MarkLogic JavaScript db driver updates…

I’ve been working on my MLDB JavaScript driver for MarkLogic 6. In this post I describe a few of the additions…

Search additions

I’ve added some new improved search functionality for MLDB. For starters, I’ve added a saveSearchOptions function that persists JSON search options to MarkLogic. These can be referred to in the search, searchCollection and structuredSearch functions. They can be used to control result set paging, format, and whether to return facets.

Structured Search has undergone some pretty sophisticated testing recently. I had a demo that required a geospatial point query (point and radius), as well as ensuring the document matched two range indexes too. This is also why I created the search options persisting functionality. You should now be able to use both these to construct as sophisticated a query as you like. Structured Search is an alternative to using cts:*-query in ML6. I’ve found it very, very useful and fast. I particularly like persisting the search options so I can refer to them throughout my application.

searchCollection is like a cross between search() and collect(). Indeed, all three use the same REST server /v1/search endpoint anyway. This also supports saved search options.

Saved search options also open up the possibility of have the user’s current ‘context’ (i.e. search result preferences) stored as search options and referred to by all queries they execute. This would make for a very nice personalised search application. You can read about all of these API functions on the WIKI.

Bug fixes

I encountered a few bugs in search, searchCollection, and structuredSearch. They should now be much more reliable. If you find out differently, please contact me at adam dot fowler at marklogic dot com.

How do I get it?

The easiest way by far is to pull down a copy using npm by issuing an ‘npm install mldb’ command. Alternatively you can use Git (as per the homepage). This version is an interim version. I’ll release the final February version at the end of the month.

What’s next for MLDB?

There has been some talk of building a command line interface using Node.JS and MLDB. I’ll write a proof of concept to duplicate some of the mlcp ingest options to see how well that works (will also mean I get to play with the mldb.fast() method of parallelising workloads)

I also want to re-architect MLDB so it can be used within a REST (or indeed Roxy) web application in a web page, as well as via Node.JS. I want to do this with maximum browser independance, but I’ll also detect if jQuery is available so as to use it’s AJAX capabilities, when present.

If there’s any features you want, please head on over to the MLDB feature requests page.

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.