- Notifications
You must be signed in to change notification settings - Fork58
RUM access method - inverted index with additional information in posting lists
License
postgrespro/rum
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
Therum module provides access method to work with RUM index. It is basedon the GIN access methods code.
This module available under the same license asPostgreSQL.
Before build and installrum you should ensure following:
- PostgreSQL version is 9.6.
Typical installation procedure may look like this:
$ git clone https://github.com/postgrespro/rum$ cd rum$ make USE_PGXS=1$ sudo make USE_PGXS=1 install$ make USE_PGXS=1 installcheck$ psql DB -c "CREATE EXTENSION rum;"
Therum module provides the access methodrum and the operator classrum_tsvector_ops.
The module provides new operators.
Operator | Returns | Description |
---|---|---|
tsvector <-> tsquery | float4 | Returns distance between tsvector and tsquery. |
Let us assume we have the table:
CREATETABLEtest_rum(ttext, a tsvector);CREATETRIGGERtsvectorupdateBEFOREUPDATEOR INSERTON test_rumFOR EACH ROW EXECUTE PROCEDURE tsvector_update_trigger('a','pg_catalog.english','t');INSERT INTO test_rum(t)VALUES ('The situation is most beautiful');INSERT INTO test_rum(t)VALUES ('It is a beautiful');INSERT INTO test_rum(t)VALUES ('It looks like a beautiful place');
To create therum index we need create an extension:
CREATE EXTENSION rum;
Then we can create new index:
CREATEINDEXrumidxON test_rum USING rum (a rum_tsvector_ops);
And we can execute the following queries:
=# SELECT t, a <-> to_tsquery('english', 'beautiful | place') AS rankFROM test_rumWHERE a @@ to_tsquery('english','beautiful | place')ORDER BY a<-> to_tsquery('english','beautiful | place'); t | rank---------------------------------+----------- The situation is most beautiful |0.0303964 It is a beautiful |0.0303964 It lookslike a beautiful place |0.0607927(3 rows)=# SELECT t, a <-> to_tsquery('english', 'place | situation') AS rankFROM test_rumWHERE a @@ to_tsquery('english','place | situation')ORDER BY a<-> to_tsquery('english','place | situation'); t | rank---------------------------------+----------- The situation is most beautiful |0.0303964 It lookslike a beautiful place |0.0303964(2 rows)
Alexander Korotkova.korotkov@postgrespro.ru Postgres Professional Ltd., Russia
Oleg Bartunovoleg@sai.msu.su Postgres Professional Ltd., Russia
Teodor Sigaevteodor@sigaev.ru Postgres Professional Ltd., Russia
About
RUM access method - inverted index with additional information in posting lists
Topics
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Packages0
Uh oh!
There was an error while loading.Please reload this page.