mirror of https://gitee.com/bigwinds/arangodb
99 lines
5.4 KiB
HTML
99 lines
5.4 KiB
HTML
<html><head><title>ArangoDB Manual</title> <style media="screen" type="text/css" style="display:none">body{background-color:white;font:13px Helvetica,arial,freesans,clean,sans-serif;line-height:1.4;color:#333;}#access{font-size:16px;margin-left:12px;display:block;margin-left:10px;margin-right:10px;background-color:#F3F1EE!important;}#access a{border-right:1px solid #DBDEDF;color:#A49F96;display:block;line-height:38px;padding:0 10px;text-decoration:none;}#navigation ul{text-transform:uppercase;list-style:none;margin:0;}#navigation li{float:left;position:relative;}#container{width:920px;margin:0 auto;}a{color:#4183C4;text-decoration:none;}.contents h2{font-size:24px;border-bottom:1px solid #CCC;color:black;}.contents h1{font-size:33px;border-bottom:1px solid #CCC;color:black;}.clearfix:after{content:".";display:block;clear:both;font-size:0;height:0;visibility:hidden;}/**/ *:first-child+html .clearfix{min-height:0;}/**/ * html .clearfix{height:1%;}</style></head><body><div id="container"><img src="images/logo_arangodb.png" width="397" height="67" alt="ArangoDB"><div id="access" role="navigation"><div id="navigation"><ul id="menu-ahome" class="menu"><li><a href="Home.html">Table of contents</a></li> <li><a href="http://www.arangodb.org">ArangoDB homepage</a></li></ul></div><div class="clearfix"></div></div><div>
|
|
<!-- Generated by Doxygen 1.7.5.1 -->
|
|
</div>
|
|
<div class="header">
|
|
<div class="headertitle">
|
|
<h1>Skip-Lists </h1> </div>
|
|
</div>
|
|
<div class="contents">
|
|
<div class="textblock"><p>This is an introduction to ArangoDB's skip-lists.</p>
|
|
<hr/>
|
|
<ul>
|
|
<li>
|
|
<a class="el" href="IndexSkiplist.html">Skip-Lists</a> <ul>
|
|
<li>
|
|
<a class="el" href="IndexSkiplist.html#IndexSkiplistIntro">Skiplist Indexes</a> </li>
|
|
<li>
|
|
<a class="el" href="IndexSkiplist.html#IndexSkiplistShell">Accessing Skip-List Indexes from the Shell</a> <ul>
|
|
<li>
|
|
<a class="el" href="IndexSkiplist.html#IndexSkiplistShellEnsureUniqueSkiplist">collection.ensureUniqueSkiplist</a> </li>
|
|
<li>
|
|
<a class="el" href="IndexSkiplist.html#IndexSkiplistShellEnsureSkiplist">collection.ensureSkiplist</a> </li>
|
|
</ul>
|
|
</li>
|
|
</ul>
|
|
</li>
|
|
</ul>
|
|
<hr/>
|
|
<h2><a class="anchor" id="IndexSkiplistIntro"></a>
|
|
Skiplist Indexes</h2>
|
|
<p>It is possible to define a skip-list index on one or more attributes (or paths) of a documents. This skip-list is then used in queries to locate documents within a given range. If the skip-list is unique, then no two documents are allowed to have the same set of attribute values.</p>
|
|
<h2><a class="anchor" id="IndexSkiplistShell"></a>
|
|
Accessing Skip-List Indexes from the Shell</h2>
|
|
<p><a class="anchor" id="IndexSkiplistShellEnsureUniqueSkiplist"></a> <hr/>
|
|
<code><b>ensureUniqueSkiplist(<em>field1</em>, <em>field2</em>, ..., <em>fieldn</em>)</b></code><hr/>
|
|
Creates a skiplist index on all documents using attributes as paths to the fields. At least one attribute must be given. All documents, which do not have the attribute path or with ore or more values that are not suitable, are ignored.</p>
|
|
<p>In case that the index was successfully created, the index identifier is returned.</p>
|
|
<div class="fragment"><pre class="fragment">arango> db.geo2.drop();
|
|
true
|
|
|
|
arango> db.geo2.ensureGeoIndex("location.latitude", "location.longitude");
|
|
23735273
|
|
|
|
arango> for (i = -90; i <= 90; i += 10)
|
|
.......> for (j = -180; j <= 180; j += 10)
|
|
.......> db.geo2.save({ name : "Name" + i + "-" + j,
|
|
.......> location: { latitude : i,
|
|
.......> longitude : j } });
|
|
|
|
arango> db.geo2.near(0,0);
|
|
{ "location" : { "latitude" : 0, "longitude" : 0 },
|
|
"name" : "Name0-0",
|
|
"_id" : "48956356:73466820" }
|
|
{ "location" : { "latitude" : 0, "longitude" : -10 },
|
|
"name" : "Name0--10",
|
|
"_id" : "48956356:73401284" }
|
|
.
|
|
.
|
|
{ "location" : { "latitude" : 20, "longitude" : -10 },
|
|
"name" : "Name20--10",
|
|
"_id" : "48956356:75891652" }
|
|
{ "location" : { "latitude" : 10, "longitude" : 20 },
|
|
"name" : "Name10-20",
|
|
"_id" : "48956356:74843076" }
|
|
...more results...
|
|
</pre></div> <p><a class="anchor" id="IndexSkiplistShellEnsureSkiplist"></a> <hr/>
|
|
<code><b>ensureSkiplist(<em>field1</em>, <em>field2</em>, ..., <em>fieldn</em>)</b></code><hr/>
|
|
Creates a multi skiplist index on all documents using attributes as paths to the fields. At least one attribute must be given. All documents, which do not have the attribute path or with ore or more values that are not suitable, are ignored.</p>
|
|
<p>In case that the index was successfully created, the index identifier is returned.</p>
|
|
<div class="fragment"><pre class="fragment">arango> db.geo2.drop();
|
|
true
|
|
|
|
arango> db.geo2.ensureGeoIndex("location.latitude", "location.longitude");
|
|
23735273
|
|
|
|
arango> for (i = -90; i <= 90; i += 10)
|
|
.......> for (j = -180; j <= 180; j += 10)
|
|
.......> db.geo2.save({ name : "Name" + i + "-" + j,
|
|
.......> location: { latitude : i,
|
|
.......> longitude : j } });
|
|
|
|
arango> db.geo2.near(0,0);
|
|
{ "location" : { "latitude" : 0, "longitude" : 0 },
|
|
"name" : "Name0-0",
|
|
"_id" : "48956356:73466820" }
|
|
{ "location" : { "latitude" : 0, "longitude" : -10 },
|
|
"name" : "Name0--10",
|
|
"_id" : "48956356:73401284" }
|
|
.
|
|
.
|
|
{ "location" : { "latitude" : 20, "longitude" : -10 },
|
|
"name" : "Name20--10",
|
|
"_id" : "48956356:75891652" }
|
|
{ "location" : { "latitude" : 10, "longitude" : 20 },
|
|
"name" : "Name10-20",
|
|
"_id" : "48956356:74843076" }
|
|
...more results...
|
|
</pre></div> </div></div>
|
|
</div></body></html>
|