We’ve joined forces with Smartlogic to reveal smarter decisions—together.

Seven Reasons to Use a Range Index in MarkLogic

Do you find yourself getting confused about range indexes in MarkLogic? When should you use range indexes?

Luckily the whitepaper Inside MarkLogic Server explains 7 uses for range indexes. If you haven’t read it, you should really consider doing so for a better understanding of how MarkLogic Server works internally. The following information comes from page 26:

1. Perform fast range queries.

For example, you can provide a query constraint for documents having a date between two given endpoints.

2. Perform data-type-aware equality queries.

For example, you can compare decimal or date values based on their semantic value rather than their lexical serialized value. (Note that you can perform equality comparisons for numeric and Boolean data types in JSON documents without a range index. See “Indexing JSON” above for details.)

3. Quickly extract specific values from the entries in a result set.

For example, you can get a distinct list of message senders from documents in a result set, as well as how often each sender appears. These are often called facets and are displayed with search results to aid search navigation. You can also perform fast aggregates against the extracted values to calculate things like standard deviation and covariance.

4. Perform optimized order by calculations.

For example, you can sort a large set of product results by price.

5. Perform efficient cross-document joins.

For example, if you have a set of documents describing people and a set of documents describing works authored by those people, you can use range indexes to efficiently run queries looking for certain kinds of works authored by certain kinds of people.

6. Perform complex date-time queries on bitemporal documents.

Bitemporal documents include four range indexes that track when events occurred in the real world as well as when the events were stored in MarkLogic. Querying the four range indexes and merging the results is key to resolving bitemporal queries. See the “Bitemporal” section for details.

7. Quickly extract co-occurring values from the entries in a result set.

For example, you can quickly get a report for which two entity values appear most often together  in documents, without knowing either of the two entity values in advance. This is a more advanced use case, so we won’t cover it in this book.

Paxton Hare | MarkLogic Alumnus

Start a discussion

Connect with the community

STACK OVERFLOW

EVENTS

GITHUB COMMUNITY

Most Recent

View All

The Future Is Already Here — It’s Just Not Very Evenly Distributed

Visionaries have cracked the code to achieving data agility - and it involves active metadata. Read this post to learn more about the patterns they use.
Read Article

Being a Visionary Isn’t Always Easy

Gartner has recognized MarkLogic as a Visionary in the Magic Quadrant for Cloud Database Management Systems. Our VP of Strategy Chuck Hollis explains what being a “visionary” means – to us and our customers.
Read Article

Log4j: An Update On “LogJam”

Get answers about the potential impact of the internet-wide Log4j vulnerability on MarkLogic environments
Read Article
This website uses cookies.

By continuing to use this website you are giving consent to cookies being used in accordance with the MarkLogic Privacy Statement.