Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
T
tarantool
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
core
tarantool
Commits
8eed499e
Commit
8eed499e
authored
9 years ago
by
ocelot-inc
Browse files
Options
Downloads
Patches
Plain Diff
RTREE dimensions > 2
parent
6f3d393b
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
doc/sphinx/book/box/box_index.rst
+63
-42
63 additions, 42 deletions
doc/sphinx/book/box/box_index.rst
doc/sphinx/book/box/limitations.rst
+2
-2
2 additions, 2 deletions
doc/sphinx/book/box/limitations.rst
with
65 additions
and
44 deletions
doc/sphinx/book/box/box_index.rst
+
63
−
42
View file @
8eed499e
...
...
@@ -196,47 +196,47 @@ API is a direct binding to corresponding methods of index objects of type
**RTREE iterator types**
+--------------------+-----------+---------------------------------------------+
| Type | Arguments | Description |
+====================+===========+=============================================+
| box.index.ALL | none | All keys match. Tuples are returned in |
| or 'ALL' | | ascending order of the primary key. |
+--------------------+-----------+---------------------------------------------+
| box.index.EQ | field | Keys match if the rectangle defined by the |
| or 'EQ' | values | field values is the same as the rectangle |
| | | defined by the key -- where "key" means |
| | | "the key in the RTREE index" and |
| | | "rectangle" means "rectangle
as explained
|
| | | in section RTREE_.
|
+--------------------+-----------+---------------------------------------------+
| box.index.GT | field | Keys match if all points of the rectangle |
| or 'GT' | values | defined by the field values are within the |
| | | rectangle defined by the key. |
+--------------------+-----------+---------------------------------------------+
| box.index.GE | field | Keys match if all points of the rectangle |
| or 'GE' | values | defined by the field values are within, or |
| | | at the side of, the rectangle defined by |
| | | the key. |
+--------------------+-----------+---------------------------------------------+
| box.index.LT | field | Keys match if all points of the rectangle |
| or 'LT' | values | defined by the key are within the rectangle |
| | | defined by the field values. |
+--------------------+-----------+---------------------------------------------+
| box.index.LE | field | Keys match if all points of the rectangle |
| or 'LE' | values | defined by the key are within, or at the |
| | | side of, the rectangle defined by the field |
| | | values. |
+--------------------+-----------+---------------------------------------------+
| box.index.OVERLAPS | field | Keys match if all points of the rectangle |
| or 'OVERLAPS' | values | defined by the key are within, or at the |
| | | side of, the rectangle defined by the field |
| | | values. |
+--------------------+-----------+---------------------------------------------+
| box.index.NEIGHBOR | field | Keys match if all points of the rectangle |
| or 'NEIGHBOR' | values | defined by the key are within, or at the |
| | | side of, the rectangle defined by the field |
| | | values. |
+--------------------+-----------+---------------------------------------------+
+--------------------+-----------+---------------------------------------------
--------
+
| Type | Arguments | Description
|
+====================+===========+=============================================
========
+
| box.index.ALL | none | All keys match. Tuples are returned in
|
| or 'ALL' | | ascending order of the primary key.
|
+--------------------+-----------+---------------------------------------------
--------
+
| box.index.EQ | field | Keys match if the rectangle
-or-box
defined by the
|
| or 'EQ' | values | field values is the same as the rectangle
-or-box
|
| | | defined by the key -- where "key" means
|
| | | "the key in the RTREE index" and
|
| | | "rectangle
-or-box
" means "rectangle
-or-box as
|
| | |
explained
in section RTREE_
"
. |
+--------------------+-----------+---------------------------------------------
--------
+
| box.index.GT | field | Keys match if all points of the rectangle
-or-box
|
| or 'GT' | values | defined by the field values are within the
|
| | | rectangle
-or-box
defined by the key.
|
+--------------------+-----------+---------------------------------------------
--------
+
| box.index.GE | field | Keys match if all points of the rectangle
-or-box
|
| or 'GE' | values | defined by the field values are within, or
|
| | | at the side of, the rectangle
-or-box
defined by
|
| | | the key.
|
+--------------------+-----------+---------------------------------------------
--------
+
| box.index.LT | field | Keys match if all points of the rectangle
-or-box
|
| or 'LT' | values | defined by the key are within the rectangle
-or-box
|
| | | defined by the field values.
|
+--------------------+-----------+---------------------------------------------
--------
+
| box.index.LE | field | Keys match if all points of the rectangle
-or-box
|
| or 'LE' | values | defined by the key are within, or at the
|
| | | side of, the rectangle
-or-box
defined by the field
|
| | | values.
|
+--------------------+-----------+---------------------------------------------
--------
+
| box.index.OVERLAPS | field | Keys match if all points of the rectangle
-or-box
|
| or 'OVERLAPS' | values | defined by the key are within, or at the
|
| | | side of, the rectangle
-or-box
defined by the field
|
| | | values.
|
+--------------------+-----------+---------------------------------------------
--------
+
| box.index.NEIGHBOR | field | Keys match if all points of the rectangle
-or-box
|
| or 'NEIGHBOR' | values | defined by the key are within, or at the
|
| | | side of, the rectangle
-or-box
defined by the field
|
| | | values.
|
+--------------------+-----------+---------------------------------------------
--------
+
|br|
...
...
@@ -627,7 +627,14 @@ Lua functions `os.date()`_ and `string.sub()`_.
=============================================================================
The :mod:`box.index` package may be used for spatial searches if the index type
is RTREE. There are operations for searching *rectangles*. Rectangles are
is RTREE. There are operations for searching *rectangles* (geometric objects
with 4 corners and 4 sides) and *boxes* (geometric objects with more than 4
corners and more than 4 sides, sometimes called hyperrectangles).
This manual uses term *rectangle-or-box* for the whole class
of objects that includes both rectangles and boxes.
Only rectangles will be illustrated.
Rectangles are
described according to their X-axis (horizontal axis) and Y-axis (vertical axis)
coordinates in a grid of arbitrary size. Here is a picture of four rectangles on
a grid with 11 horizontal points and 11 vertical points:
...
...
@@ -693,6 +700,20 @@ NEIGHBOR iterator always returns all tuples, and the first returned tuple will
be {3,5,9,10} ("Rectangle#2" in the picture) because it is the closest neighbor
of {1,2,3,4} ("Rectangle#1" in the picture).
Now let us create a space and index for cuboids, which are rectangle-or-boxes that have
6 corners and 6 sides.
| :codebold:`box.schema.space.create('R')`
| :codebold:`box.space.R:create_index('primary',{parts={1,'NUM'}})`
| :codebold:`box.space.R:create_index('S',{type='RTREE',unique=false,dimension=3,parts={2,'ARRAY'}})`
The additional field here is 'dimension=3'. The default dimension is 2, which is
why it didn't need to be specified for the examples of rectangle. The maximum dimension
is 20. Now for insertions and selections there will usually be 6 coordinates. For example:
| :codebold:`box.space.R:insert{1,{0,3,0,3,0,3}}`
| :codebold:`box.space.R.index.S:select({1,2,1,2,1,2},{iterator=box.index.GT})`
More examples of spatial searching are online in the file `R tree index quick
start and usage`_.
...
...
This diff is collapsed.
Click to expand it.
doc/sphinx/book/box/limitations.rst
+
2
−
2
View file @
8eed499e
...
...
@@ -4,8 +4,8 @@
Number of fields in an index
For BITSET indexes, the maximum is 1. For TREE or HASH indexes, the maximum
is 255 (``box.schema.INDEX_PART_MAX``). For RTREE indexes, the
number of
fields must be either 2 or 4
.
is 255 (``box.schema.INDEX_PART_MAX``). For RTREE indexes, the
maximum is 1 but the field is an ARRAY
.
Number of indexes in a space
10 (``box.schema.INDEX_MAX``).
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment