Skip to content

Commit 07b5166

Browse files
author
Artur Zakirov
committed
Added ts_distance operator
1 parent 7f819a0 commit 07b5166

File tree

4 files changed

+421
-63
lines changed

4 files changed

+421
-63
lines changed

rum--1.0.sql

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,18 @@ LANGUAGE C;
77
CREATE ACCESS METHOD rum TYPE INDEX HANDLER rumhandler;
88

99
-- Opclasses
10+
CREATE FUNCTION rum_ts_distance(tsvector,tsquery)
11+
RETURNS float4
12+
AS 'MODULE_PATHNAME'
13+
LANGUAGE C IMMUTABLE STRICT;
14+
15+
CREATE OPERATOR >< (
16+
LEFTARG = tsvector,
17+
RIGHTARG = tsquery,
18+
PROCEDURE = rum_ts_distance,
19+
COMMUTATOR = '><'
20+
);
21+
1022
CREATE FUNCTION rum_extract_tsvector(tsvector,internal,internal,internal,internal)
1123
RETURNS internal
1224
AS 'MODULE_PATHNAME'
@@ -37,6 +49,7 @@ FOR TYPE tsvector USING rum
3749
AS
3850
OPERATOR 1 @@ (tsvector, tsquery),
3951
OPERATOR 2 @@@ (tsvector, tsquery),
52+
OPERATOR 3 >< (tsvector, tsquery) FOR ORDER BY pg_catalog.float_ops,
4053
FUNCTION 1 bttextcmp(text, text),
4154
FUNCTION 2 rum_extract_tsvector(tsvector,internal,internal,internal,internal),
4255
FUNCTION 3 rum_extract_tsquery(tsvector,internal,smallint,internal,internal,internal,internal),

rum.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -743,6 +743,7 @@ extern Datum rum_extract_tsquery(PG_FUNCTION_ARGS);
743743
extern Datum rum_tsvector_config(PG_FUNCTION_ARGS);
744744
extern Datum rum_tsquery_pre_consistent(PG_FUNCTION_ARGS);
745745
extern Datum rum_tsquery_distance(PG_FUNCTION_ARGS);
746+
extern Datum rum_ts_distance(PG_FUNCTION_ARGS);
746747

747748
/* GUC parameters */
748749
extern PGDLLIMPORT int RumFuzzySearchLimit;

0 commit comments

Comments
 (0)