[MarkLogic Dev General] Indexing in MarkLogic for FasterSearches
tim at aaom.net
Thu Dec 16 12:13:49 PST 2010
Hi Jason - Thanks for the info!
From: general-bounces at developer.marklogic.com
[mailto:general-bounces at developer.marklogic.com] On Behalf Of Jason Hunter
Sent: Thursday, December 16, 2010 2:18 PM
To: General MarkLogic Developer Discussion
Subject: Re: [MarkLogic Dev General] Indexing in MarkLogic for
On Dec 16, 2010, at 11:01 AM, Tim Meagher wrote:
I guess what I don't understand is how the range query within a cts:search
uses a range index. I'm used to associating range indexes with lexicon
searches. In the case of lexicon searches, the frequency of occurrences
depends on the number of fragments in which an indexed value occurs, so I
don't understand how the range searches work with cts:search in contrast to
a term search such as cts:element-value-query. I'm probably just not
understanding the big picture correctly.
The range index can be thought of as an in-memory data structure that maps
fragment ids to values (sorted by fragment id), and values to fragment ids
(sorted by values). So when doing a lexicon call you use the id->value
mapping to quickly get values for ids resolved by other indexes. But when
using a range query constraint, you use the value->id mapping to quickly get
the fragment ids matching the query value constraint.
I would expect the range query to be faster than cts:element-value-query for
exact queries as it takes advantage of range indexes rather than a term
Both will be extremely fast. Fast enough that I wouldn't worry about which
one is technically faster.
However, the range query doesn't provide all the nice search options
(case, punctuation sensitivity choices.). Why would one ever use
cts:element-value-query() with the exact option if range queries are faster?
Ah, because you might not have the range index enabled.
Why not include the various sensitivity options with the range query?
You do get collation options with a range index, which gives you various
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the General