88
99##Introduction
1010
11- The** rum** module provides access method to work with` RUM ` index. It is based
12- on the` GIN ` accessmethods code.
11+ The** rum** module providesan access method to work with a ` RUM ` index. It is based
12+ on the` GIN ` accessmethod's code.
1313
14- ` GIN ` index allowsto perform fast full text search using` tsvector ` and
15- ` tsquery ` types. But full text search with GIN index has several problems:
14+ A ` GIN ` index allowsperforming fast full- text search using` tsvector ` and
15+ ` tsquery ` types. But full- text search with a GIN index has several problems:
1616
17- - Slow ranking. Itis need position information aboutlexems to ranking.` GIN `
18- index doesn't store positions oflexems . So after indexscan we needadditional
19- heap scan to retrievelexems positions.
20- - Slow phrase search with` GIN ` index. This problem relateswith previous
21- problem. Itis need position information to perform phrase search.
22- - Slow ordering by timestamp.` GIN ` index can't store some related information
23- in index with lexemes. So it is necessary to perform additional heap scan.
17+ - Slow ranking. Itneeds positional information aboutlexemes todo ranking. A ` GIN `
18+ index doesn't store positions oflexemes . So after indexscanning, we needan
19+ additional heap scan to retrievelexeme positions.
20+ - Slow phrase search witha ` GIN ` index. This problem relatesto the previous
21+ problem. Itneeds positional information to perform phrase search.
22+ - Slow ordering by timestamp.A ` GIN ` index can't store some related information
23+ inthe index with lexemes. So it is necessary to perform an additional heap scan.
2424
25- ` RUM ` solvesthis problems by storing additional information in posting tree.
25+ ` RUM ` solvesthese problems by storing additional information in a posting tree.
2626For example, positional information of lexemes or timestamps. You can get an
27- idea of` RUM ` by the followingpicture :
27+ idea of` RUM ` with the followingdiagram :
2828
2929![ How RUM stores additional information] ( img/gin_rum.png )
3030
31- Drawback of` RUM ` is that it has slower build and inserttime than` GIN ` .
32- It is because we need to store additional information besides keys and because
33- ` RUM ` uses generic WAL records.
31+ A drawback of` RUM ` is that it has slower build and inserttimes than` GIN ` .
32+ This is because we need to store additional information besides keys and because
33+ ` RUM ` uses genericWrite-Ahead Log ( WAL) records.
3434
3535##License
3636
37- This module available under the[ license] ( LICENSE ) similar to
37+ This moduleis available under the[ license] ( LICENSE ) similar to
3838[ PostgreSQL] ( http://www.postgresql.org/about/licence/ ) .
3939
4040##Installation
4141
42- Beforebuild andinstall ** rum** you should ensure following:
42+ Beforebuilding andinstalling ** rum** , you should ensure following are installed :
4343
4444* PostgreSQL version is 9.6+.
4545
@@ -62,7 +62,7 @@ Typical installation procedure may look like this:
6262
6363##Common operators and functions
6464
65- ** rum** module provides next operators.
65+ The ** rum** module provides next operators.
6666
6767| Operator | Returns | Description
6868| -------------------- | ------- | ----------------------------------------------
@@ -71,19 +71,19 @@ Typical installation procedure may look like this:
7171| timestamp< ; =| ; timestamp | float8 | Returns distance only for left timestamps.
7272| timestamp| ; => ; timestamp | float8 | Returns distance only for right timestamps.
7373
74- Last three operations alsoworks for types timestamptz, int2, int4, int8, float4, float8,
74+ The last three operations alsowork for types timestamptz, int2, int4, int8, float4, float8,
7575money and oid.
7676
7777##Operator classes
7878
79- ** rum** providesnext operator classes.
79+ ** rum** providesthe following operator classes.
8080
8181###rum_tsvector_ops
8282
8383For type:` tsvector `
8484
85- This operator class stores` tsvector ` lexemes with positional information.Supports
86- ordering by` <=> ` operator and prefix search.There is the example.
85+ This operator class stores` tsvector ` lexemes with positional information.It supports
86+ ordering bythe ` <=> ` operator and prefix search.See the example below .
8787
8888Let us assume we have the table:
8989
@@ -140,8 +140,8 @@ SELECT t, a <=> to_tsquery('english', 'place | situation') AS rank
140140
141141For type:` tsvector `
142142
143- This operator class stores hash of` tsvector ` lexemes with positional information.
144- Supports ordering by` <=> ` operator.But ** doesn't** support prefix search.
143+ This operator class storesa hash of` tsvector ` lexemes with positional information.
144+ It supports ordering bythe ` <=> ` operator.It ** doesn't** support prefix search.
145145
146146###rum_TYPE_ops
147147
@@ -153,17 +153,18 @@ Supported operations: `<`, `<=`, `=`, `>=`, `>` for all types and
153153` <=> ` ,` <=| ` and` |=> ` for int2, int4, int8, float4, float8, money, oid,
154154timestamp and timestamptz types.
155155
156- Supports ordering by` <=> ` ,` <=| ` and` |=> ` operators.Can be used with
156+ This operator supports ordering bythe ` <=> ` ,` <=| ` and` |=> ` operators.It can be used with
157157` rum_tsvector_addon_ops ` ,` rum_tsvector_hash_addon_ops' and ` rum_anyarray_addon_ops` operator classes.
158158
159159###rum_tsvector_addon_ops
160160
161161For type:` tsvector `
162162
163- This operator class stores` tsvector ` lexems with any supported by module
164- field.There is the example.
163+ This operator class stores` tsvector ` lexemes with any supported by module
164+ field.See the example below .
165165
166166Let us assume we have the table:
167+
167168``` sql
168169CREATE TABLE tsts (idint , t tsvector, dtimestamp );
169170
@@ -202,16 +203,16 @@ SELECT id, d, d <=> '2016-05-16 14:21:25' FROM tsts WHERE t @@ 'wr&qh' ORDER BY
202203
203204For type:` tsvector `
204205
205- This operator class stores hash of` tsvector ` lexems with any supported by module
206+ This operator class storesa hash of` tsvector ` lexemes with any supported by module
206207field.
207208
208- ** Doesn 't** support prefix search.
209+ It ** doesn 't** support prefix search.
209210
210211###rum_tsquery_ops
211212
212213For type:` tsquery `
213214
214- Stores branches of query tree in additional information. For example we have the table:
215+ It stores branches of query tree in additional information. For example, we have the table:
215216``` sql
216217CREATE TABLE query (q tsquery, tagtext );
217218
@@ -240,8 +241,8 @@ SELECT * FROM query
240241For type:` anyarray `
241242
242243This operator class stores` anyarray ` elements with length of the array.
243- Supports operators` && ` ,` @> ` ,` <@ ` ,` = ` ,` % ` operators.Supports ordering by` <=> ` operator.
244- For example we have the table:
244+ It supports operators` && ` ,` @> ` ,` <@ ` ,` = ` ,` % ` operators.It also supports ordering by` <=> ` operator.
245+ For example, we have the table:
245246
246247``` sql
247248CREATE TABLE test_array (i int2[]);