[MarkLogic Dev General] No query parser?

Mattio Valentino mattio.valentino at gmail.com
Wed May 9 12:53:37 PDT 2007


Before I start asking for some advice, is it true that MarkLogic does
not have any sort of query parser?

I'm looking for something that can take a reasonably parseable string
from a user and pass me back a query expression that MarkLogic can
understand.  So, if the user typed in...

hamlet or macbeth and "harold bloom" not psychology

..I'd like to parse that into something I can feed to cts:search().
I've seen the examples in the Developer's Guide to handle quoted
strings and to build an expression that is a series of
cts:word-query()s nested within a cts:and-query(), but nothing on how
to come up with something that would be nested.  A query like the
above could be parsed into something like:

cts:and-not-query(
  cts:and-query(
    cts:or-query( cts:word-query("hamlet"), cts:word-query("macbeth") ),
    cts:word-query("harold bloom")
  ),
  cts:word-query("psychology")
)

Is there nothing built-in for this?


More information about the General mailing list