Solutions

MarkLogic Data Hub Service

Fast data integration + improved data governance and security, with no infrastructure to buy or manage.

Learn More

Learn

Stay On Top Of Everything MarkLogic

Be the first to know! News, product information, and events delivered straight to your inbox.

Sign Me Up

Community

MarkLogic World 2019

Learn how to simplify data integration & build innovative applications. Join us in Washington D.C. May 14-15!

Find Out More

Company

Stay On Top Of Everything MarkLogic

Be the first to know! News, product information, and events delivered straight to your inbox.

Sign Me Up

Query-Limited Facets

Earlier we mentioned a fifth argument to cts:element-attribute-values(). The fifth argument is a cts:query object that limits the returned results to those taken from documents matching the given cts:query. The following finds the top senders of mails matching a specific query.

We're extracting values from the from/@personal attributes, which holds the human-readable names of senders. We start at "" (the beginning), ask for results in frequency order (so the most common occurrances are first), and limit results to the $query. We then print the value and count for the top 100. These are the folks from Apache and Firefox who talk a lot about releases.

We can also extract message/@year-month and sort by value (value is the default) and what we'll see is a traffic-by-month report, the basis for the MarkMail histogram chart:

We've now seen almost all the building blocks of MarkMail.org. But how do we take the user's typed string in the search box and convert it to cts:query objects? For that we can use the Search API.

Functions

The Search API

Stack Overflow iconStack Overflow: Get the most useful answers to questions from the MarkLogic community, or ask your own question.

Comments

The commenting feature on this page is enabled by a third party. Comments posted to this page are publicly visible.