Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

RUM access method - inverted index with additional information in posting lists

License

NotificationsYou must be signed in to change notification settings

postgrespro/rum

 
 

Repository files navigation

Introduction

Therum module provides access method to work with RUM index. It is basedon the GIN access methods code.

License

This module available under the same license asPostgreSQL.

Installation

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;"

New access method and operator class

Therum module provides the access methodrum and the operator classrum_tsvector_ops.

The module provides new operators.

OperatorReturnsDescription
tsvector <-> tsqueryfloat4Returns distance between tsvector and tsquery.

Examples

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)

Authors

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

Stars

Watchers

Forks

Packages

No packages published

Contributors24


[8]ページ先頭

©2009-2025 Movatter.jp