marklogicmarklogic-10

Undefined function op:generate-view()


I checked out the Optic APIs Documentation to create views with op:generate-view(), and I'm on MarkLogic v10.0-6.1.

The docs say that the op:generate-view() function is included in MarkLogic v10, but I'm running into an error [1.0-ml] XDMP-UNDFUN: (err:XPST0017) Undefined function op:generate-view(), and I'm not quite sure why.

Sample code -

xquery version "1.0-ml";

import module namespace op="http://marklogic.com/optic" at "/MarkLogic/optic.xqy";

op:from-view("main", "test")
   => op:select(("name", "age"))
   => op:order-by("name")
   => op:generate-view("main", "person")

Can someone help me figure this out?


Solution

  • The latest MarkLogic 10 release is currently 10.0-11.

    Unfortunately, the functions do not have a @since annotation to indicate which specific version they were introduced, and the documentation is amended as later point releases are published. This can lead to some confusion if you are using older versions and find newer functions in the documentation.

    Query Based Views were introduced in 10.0-7. While I don't see op:generate-view() listed in the New Functions Added to Optic API for that release, it is referenced in the Optic API section of the application developers guide that is linked to from the release notes.

    You will need to upgrade if you want to use that function and feature.