[MarkLogic Dev General] Natural language version of a query?

Geert Josten geert.josten at dayon.nl
Thu Aug 16 01:22:13 PDT 2012

Hi Tim,

There is a grammar option in search:search options, but haven't looked
into that myself yet. Perhaps the documentation can make clear whether you
can use that or not.

Alternative is to pre-process the search query yourself. You can try to
tackle it with regex, but it might be more fun to write a grammar for it
and use the handy site maintained by Gunther Rademacher to generate XQuery
code out of it:


Kind regards,

-----Oorspronkelijk bericht-----
Van: general-bounces at developer.marklogic.com
[mailto:general-bounces at developer.marklogic.com] Namens Tim Finney
Verzonden: woensdag 15 augustus 2012 23:29
Aan: general at developer.marklogic.com
Onderwerp: [MarkLogic Dev General] Natural language version of a query?

Hi All,

Has anyone here tried to produce a natural language equivalent of a search
string or the kind used in search:search? As an example, here is an
imaginary search string:

cat OR dog (author:"Smith, John" OR author:"Jones, Thomas")
date-after:1984-03-01 date-before:1991-05-31

I'd like to end up with something like this:

cat OR dog with authors "Smith, John" OR "Jones, Thomas" AND after
1984-03-01 AND before 1991-05-31

(Things are complicated by parentheses, NEAR, NOT, ...)

Are there any built-in functions for doing such a thing?


Tim Finney

General mailing list
General at developer.marklogic.com

More information about the General mailing list