Clever
Llamas
Home
Services
About Us
Articles
Articles
All
API Samples
Best Practices
cts
CTS Query
Geospatial
GraphQL
Indexes
JavaScript
JSON
Llama Lessons
MarkLogic
MarkLogic 11
Optic API
Performance
Queries
Search
Security
Starter Pack
TDE
Toolbox
All About Fragments
A Complete MarkLogic Guide to Fragment Behaviour
MarkLogic fragment roots and fragment parents shape XML indexing, search behaviour, hit scoping, and application-side result mapping. This guide explains how fragment boundaries affect real queries and how to configure them for reliable production search behaviour.
MarkLogic
Performance
Indexes
Llama Lessons
MarkLogic Community Event
July 2023
This recap of the July 2023 MarkLogic Community Event covers the Clever Llamas presentation on MarkLogic consulting, proof of values, health checks, and professional services. The recorded session shows how these services help teams build and sustain MarkLogic expertise.
News
Llamaverse
Deploying and Using the Llamaverse 2.5.0 Dataset
Llamaverse 2.5.0 is the canonical sample dataset used across Clever Llamas MarkLogic articles, with deployment guidance, security roles, entity relationships, vector-ready content families, curated relevance quality profiles, and geospatial region settings required by temporal, namespace-aware path, lexicon-driven, and reverse-geospatial examples.
Toolbox
Prototype TDE templates
Test SQL and Optic Against TDE Template Without Installing
Prototype MarkLogic TDE templates without installation or reindexing by combining tde:node-data-extract() with op:from-literals() and op:from-sparql(). This approach speeds up TDE development while preserving realistic datatype handling and query testing.
TDE
Toolbox
Optic API
Optic Data Analysis Starter Pack
Group, aggregate, reshape, and expand Optic result sets without losing the thread
Aggregate and group data with op:group-by(), op:array-aggregate(), op:group-to-arrays(), and op:group-by-union(). Build reporting shapes and ungrouping patterns with runnable llamaverse examples.
MarkLogic
Optic API
Starter Pack
API Samples
TDE Document Fragment
Using the document fragment in your views
Document fragments in MarkLogic TDE views affect runtime access patterns, join design, and view performance. This guide shows how to use fragment IDs and XPath lookups to enrich TDE-backed queries efficiently, especially on large datasets.
TDE
Toolbox
Optic API
Text Query Building Starter Pack
Compose text queries without turning your code into spaghetti
Master text search with cts:word-query(), cts:or-query(), and cts:not-query(). Tune stemming, wildcarding, case/diacritic sensitivity, and synonym behaviour with runnable examples on llamaverse data.
MarkLogic
cts
Starter Pack
API Samples
Temporal Collections - Bitemporal vs Unitemporal
Understanding Time-Based Versioning
MarkLogic temporal collections support unitemporal and bitemporal models, and the difference directly affects auditability, compliance, and operational complexity. This article explains valid time versus system time, shows how axes and collections are configured, and highlights query patterns for each model. Use it as a production guide to choose the right temporal design early and avoid expensive migration later.
MarkLogic
Temporal
Versioning
Llama Lessons
JavaScript vs XQuery - When to Choose Which
Making the Right Language Choice
MarkLogic gives you both JavaScript and XQuery, and both are powerful, but they are not equally natural for every task. This guide gives practical, no-nonsense rules for choosing well across XML-heavy, JSON-heavy, and mixed workloads so your team ships faster with fewer avoidable mistakes.
MarkLogic
JavaScript
XQuery
Llama Lessons
Optic Update — JavaScript Implementation
Combining Row Pipelines with Document Mutation
Optic Update in MarkLogic 11 extends the Optic row pipeline into document mutation through patchBuilder, JavaScript APIs, and XQuery bridge patterns. This guide explains what is stable, what is preview, and the transaction and isolation habits required for safe production use.
MarkLogic
Optic
JavaScript
Llama Lessons
Native Vector Search - AI-Powered Similarity at Scale
Practical Retrieval Design with Llamaverse 2.3.1
Most vector search implementations fail not because the model is wrong, but because the retrieval design is incomplete. This article shows how MarkLogic 12 lets you combine semantic similarity with permissions, metadata constraints, and lexical precision in a single query path — and uses the Llamaverse 2.3.1 vector lab to prove it with measured benchmarks, adversarial stress tests, and threshold analysis.
MarkLogic 12
Vector Search
AI
GenAI
Retrieval Engineering
cts:document-root-query()
Released in MarkLogic 11
Find XML and JSON root elements with cts:document-root-query(). Learn how to filter documents by root-level structure, handle mixed-content repositories, and build root-scoped search patterns.
MarkLogic 11
CTS Query
GraphQL
Explicit schemas
Explicit GraphQL schemas in MarkLogic 11 let you model complex relationships with directives such as @View and @Join. Llamaverse examples show how to configure and query richer GraphQL schemas while accounting for current platform limits.
MarkLogic 11
GraphQL
Relevance Scoring - What Really Affects It
Understanding MarkLogic's Ranking Algorithm
MarkLogic relevance scoring determines result order using term frequency, inverse document frequency, query structure, and score options. This article explains why ties occur, how scoring behaves across common query patterns, and what changed between MarkLogic 11 and MarkLogic 12 defaults. Use it as a production guide to tune ranking with measurable evidence instead of guesswork.
MarkLogic
Search
Relevance
Llama Lessons
One Indexing Model for JSON and XML
Match Query Functions to the Right Index Across Both Document Models
JSON and XML queries in MarkLogic are conceptual twins: the same indexing decisions, the same range-query trade-offs, and the same failure modes when query type and index type do not match. This guide gives one unified decision framework, then shows the exact JSON and XML function variants side by side so you can move from idea to correct query pattern without guesswork.
MarkLogic
Indexes
JSON
Triple Index and TDE Interaction
Understanding the Shared Foundation
MarkLogic stores both semantic triples and TDE rows on the triple index, and that shared foundation directly affects security, reindexing, and query behaviour. This guide explains the architecture, the `cts:column-range-query()` gotcha, and the practical design decisions teams need for reliable TDE workloads.
MarkLogic
TDE
Semantics
Llama Lessons
Search Composition Starter Pack
Build and inspect practical query blocks on top of llamaverse content
Compose production-grade search with cts:search(), cts:and-query(), cts:contains(), cts:walk(), cts:highlight(), cts:parse(), and cts:estimate(). See how search text becomes nested and/or/near query trees, add lexicon-first scope with cts:uri-match() and cts:collection-match(), and validate behaviour with runnable llamaverse outputs.
MarkLogic
cts
Starter Pack
API Samples
Triggers - Best Practices
Effective Trigger Implementation
MarkLogic triggers can enforce validation, launch post-commit side effects, and automate data workflows, but they sit directly on critical write paths. This article explains pre-commit versus post-commit trigger design, trigger security context, recursion avoidance, and why tracing is essential for reliable troubleshooting in production. Use it as a practical guide to building trigger patterns that remain observable, safe, and performant under real workload pressure.
MarkLogic
Triggers
Best Practices
Llama Lessons
Document Permissions Query
Using cts:document-permission-query()
Learn how to use MarkLogic cts:document-permission-query() to find documents by read/update permissions, run scoped security audits, detect missing role permissions, and review live query examples with URI estimates and sample results.
MarkLogic
Security
CTS Query
Llama Lessons
Data Pipelines with n8n and MarkLogic
Part 1 - Data Ingestion
Build automated data pipelines with n8n and MarkLogic for JSON ingestion, workflow orchestration, and AI-ready data preparation. This first part focuses on ingestion patterns that support later work with LLMs, vector search, and RAG.
n8n
MarkLogic
ingestion
Optic Data Source Starter Pack
Build Optic plans from views, lexicons, search, documents, and descriptors
Query diverse data sources with Optic functions like op.fromView(), op.fromSearch(), op.fromLexicons(), and op.fromSparql(). Build stable row plans from views, lexicons, search results, and more.
MarkLogic
Optic API
Starter Pack
API Samples
GraphQL
Getting started
Get started with GraphQL in MarkLogic 11 by connecting built-in GraphQL support to existing schemas, views, and TDE templates. Llamaverse examples show implicit schemas, custom directives, range queries, sorting, and pagination.
MarkLogic 11
GraphQL
Near Queries and Proximity Search
Understanding How MarkLogic Measures Nearness
MarkLogic near queries let you search for terms that occur close together using index-based word-position distance. This article explains ordered and unordered proximity matching, fragment-boundary behaviour, property scoping, and practical performance patterns for production search. Use it to design near-query logic that stays accurate, interpretable, and fast on real MarkLogic datasets.
MarkLogic
Search
Queries
Llama Lessons
Optic Geospatial
Released in MarkLogic 11
MarkLogic 11 Optic API geospatial features support spatial queries, movement tracking, and location analysis through TDE-backed data and SQL-style access. Practical examples cover implementation limits, performance trade-offs, and query design for geospatial workloads.
MarkLogic 11
Optic API
Geospatial
Relevance and Scoring Starter Pack
Understand what ranked first and why
Understand MarkLogic relevance tuning with cts:score(), cts:confidence(), cts:fitness(), cts:remainder(), cts:quality(), and cts:relevance-info(). Learn why results rank in a specific order and how to inspect the signals behind that ranking.
MarkLogic
cts
Starter Pack
API Samples
JSON Root Elements and Document Structure
Understanding JSON Document Organisation in MarkLogic
JSON documents in MarkLogic do not have XML-style named root elements, which changes how structure, type identification, and query scoping work in production systems. This article explains the JSON node model, cts:document-root-query behaviour, path navigation, TDE context choices, and namespace-free subtree matching with scope queries. Use it as a practical guide to design predictable JSON document shapes and avoid silent structural query failures.
MarkLogic
JSON
Document Design
Llama Lessons
Optic Data Manipulation Starter Pack
Shape XML, run expression libraries at runtime, and execute update plans cleanly
Transform row data with op:xpath(), op:write(), and op:execute(). Shape XML into rows, prove runtime expression evaluation with ofn/oxs/oxdmp, and drive privilege-snapshot update pipelines.
MarkLogic
Optic API
Starter Pack
API Samples
Filtered vs Unfiltered Searches
Understanding Search Behavior in MarkLogic
Filtered and unfiltered searches in MarkLogic trade query accuracy against speed, and the defaults vary by API and query shape. This guide explains when each mode applies, how path expressions change behavior, and when unfiltered results can be trusted.
MarkLogic
Search
Performance
Llama Lessons
Geospatial Indexes — Point vs Region
Deep Dive on Geospatial Index Architecture in MarkLogic
MarkLogic geospatial search depends on choosing the right index type for points versus regions, with direct consequences for correctness, topology, and query design. This guide covers coordinate systems, rollout decisions, and production troubleshooting for geospatial workloads.
MarkLogic
Geospatial
Indexes
URI Directory Queries in MarkLogic
How Slash Hierarchies Shape Query Scope
MarkLogic directory behaviour comes from URI structure, where each slash level defines queryable scope without requiring filesystem folders. This article explains how to use cts:directory-query depth correctly, avoid empty-result traps, and design URI hierarchies that support precise operational queries at scale. It also covers legacy WebDAV directory documents and safe, destructive-operation handling for directory deletion workflows.
MarkLogic
Directories
Document Management
cts:document-permission-query()
Released in MarkLogic 11
Query MarkLogic documents by permission status using cts:document-permission-query(). Learn how to build permission-aware search, audit security policies, and filter results by role or capability. Includes practical examples for access-control analysis.
MarkLogic 11
CTS Query
Optic Update
Released in MarkLogic 11
Optic Update in MarkLogic 11 extends the Optic API with JavaScript-based document mutation, including document descriptors, URI handling, locking, and temporal support. Code analysis and practical examples cover both simple and advanced update scenarios along with current preview limitations.
MarkLogic 11
Optic API
Path Namespaces - Query Configuration
Namespace Handling in Path Expressions
Namespace handling in MarkLogic path expressions controls whether XPath and path-range queries resolve element names correctly. This article explains how default namespaces, prefixed namespaces, and null namespaces affect matching behaviour, index usage, and query results in XML-heavy systems. Use it as a production guide to diagnose silent empty-result failures and configure namespace-aware queries reliably.
MarkLogic
XPath
Namespaces
Llama Lessons
The Importance of Traces
If You Are Not Tracing, You Are Troubleshooting Blind
MarkLogic traces are one of the most practical tools for production troubleshooting because they let code emit targeted diagnostics only when specific trace events are enabled. This guide explains `xdmp:trace()`, `xdmp:trace-enabled()`, and how to vary trace detail using current app-server log level so your logs stay useful instead of noisy. Use it to build trace output that tells a coherent troubleshooting story for the engineer who picks up the issue next.
MarkLogic
Tracing
Debugging
Best Practices
All About Lexicons
URI, Collection, Value, Tuple and Optic Patterns in MarkLogic
MarkLogic lexicons let you answer URI, collection, and typed-value questions directly from indexes rather than scanning full documents. This guide shows practical MarkLogic 11+ patterns for `cts:uris`, `cts:values`, `cts:range-query`, `cts:tuples`, field references, and `op.fromLexicons`. Use it to build faster, safer query flows for faceting, filtering, co-occurrence analysis, and restartable operations.
MarkLogic
Lexicons
Performance
Llama Lessons
Element Range Queries — Scalar Type Implications
Why Data Types Matter More Than You Think
Element range index scalar types in MarkLogic determine how values are indexed, compared, and returned by range queries. This article explains how type alignment affects correctness, index coverage, and production behaviour across strings, numbers, and date/time values. Use it as a practical guide to choose the right scalar type, avoid silent mismatches, and build predictable range-query designs.
MarkLogic
Indexes
Data Types
Llama Lessons
MarkLogic Security Model
Roles, Privileges, Permissions, and Amps
MarkLogic security works only when roles, privileges, document permissions, and amps are treated as separate control layers with different responsibilities. This article shows how those layers fit together in the real Llamaverse security model, where users, roles, URI privileges, and document permissions combine into an auditable access-control design. It also explains why execution-boundary functions such as eval and invoke need explicit amp-handling decisions instead of relying on inherited privilege state.
MarkLogic
Security
Best Practices
All About Transactions
MVCC, Locks, XA, and Cross-Transaction Execution in MarkLogic
MarkLogic transactions control how query and update work happens across MVCC snapshots, locks, and commit boundaries. This article explains how query and update transactions behave, how XA and cross-transaction execution fit in, and where AMP handling changes practical outcomes. Use it as a production guide for diagnosing transaction visibility, avoiding lock surprises, and designing safer MarkLogic applications.
MarkLogic
Transactions
ACID
Llama Lessons
Marklogic 11
Overview
This MarkLogic 11 review is based on more than 120 hours of testing across new features, bug fixes, and developer-facing changes. It covers the new UI, GraphQL, enhanced CTS and XDMP functions, Optic Update preview, and geospatial features with a practical assessment of real-world impact.
MarkLogic 11
Element Level Security
Working with TDE's
Template Driven Extraction (TDE) and Element Level Security (ELS) interact in ways that directly affect row visibility, document access, and security design in MarkLogic. Practical examples show the pitfalls and design implications for building secure TDE-backed applications.
TDE
Security
URI and Collection Auditing Starter Pack
Reliable URI-level checks for real llamaverse operations
Audit document URIs and collections with cts:uris(), cts:collection-query(), and cts:collection-match(). Use wildcard discovery and collection scoping to validate document identity and organization in production systems.
MarkLogic
cts
Starter Pack
API Samples
Migrating Server-Side JavaScript to MarkLogic 12
What Breaks, What Improves, and How to Upgrade Without Guesswork
MarkLogic 12 ships a much newer V8 engine, and your server-side JavaScript will feel the difference — some of it immediately, and some of it quietly, until a llama hits a fence post at speed. This guide covers what actually breaks, why it breaks, and how to fix it without turning a version bump into a month of surprises. Compatibility repairs first, then the genuinely useful new language features, then the grep commands to audit a whole codebase before anyone touches production.
MarkLogic
JavaScript
Upgrade
Best Practices
Llama Lessons
Word Queries vs Value Queries
Choosing the Right Query Type
Word queries and value queries in MarkLogic may both accept strings, but they use different index behaviour and solve different search problems. This article explains when to use each query type, how token matching differs from exact value matching, and where range and lexicon-based queries fit in production designs. Use it as a practical guide to choose the right query pattern, avoid misleading results, and build more predictable search features.
MarkLogic
Search
Queries
Llama Lessons
1 Day Challenge - Kendo UI and MarkLogic
Overview
This one-day Kendo UI and MarkLogic integration challenge explores what happens when MarkLogic backend capabilities meet Progress Kendo UI on the frontend. A video demonstration shows the practical result of building a working prototype in a single focused day.
MarkLogic 11
Kendo UI
0
keyboard_arrow_down
keyboard_arrow_up