This repository has been archived by the owner on Dec 1, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 15
/
sphinx--0.3.sql
65 lines (55 loc) · 1.53 KB
/
sphinx--0.3.sql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
CREATE TYPE sphinx_search_result AS (id int, weight int);
CREATE OR REPLACE FUNCTION sphinx_select(
/*index*/ varchar,
/*query*/ varchar,
/*condition*/ varchar,
/*order*/ varchar,
/*offset*/ int,
/*limit*/ int,
/*options*/ varchar)
RETURNS SETOF sphinx_search_result
AS 'sphinx', 'pg_sphinx_select'
LANGUAGE C IMMUTABLE;
CREATE OR REPLACE FUNCTION sphinx_replace(
/*index*/ varchar,
/*id*/ int,
/*data*/ varchar[])
RETURNS VOID
AS 'sphinx', 'pg_sphinx_replace'
LANGUAGE C IMMUTABLE;
CREATE OR REPLACE FUNCTION sphinx_delete(
/*index*/ varchar,
/*id*/ int)
RETURNS VOID
AS 'sphinx', 'pg_sphinx_delete'
LANGUAGE C IMMUTABLE;
CREATE OR REPLACE FUNCTION sphinx_snippet(
/*index*/ varchar,
/*query*/ varchar,
/*data*/ varchar,
/*before*/ varchar,
/*after*/ varchar)
RETURNS VARCHAR
AS 'sphinx', 'pg_sphinx_snippet'
LANGUAGE C IMMUTABLE;
CREATE OR REPLACE FUNCTION sphinx_snippet_options(
/*index*/ varchar,
/*query*/ varchar,
/*data*/ varchar,
/*options*/ varchar[])
RETURNS VARCHAR
AS 'sphinx', 'pg_sphinx_snippet_options'
LANGUAGE C IMMUTABLE;
CREATE TABLE sphinx_config (
"key" varchar(32) NOT NULL,
"value" varchar(255) NOT NULL,
PRIMARY KEY ("key")
);
GRANT ALL ON sphinx_config TO PUBLIC;
INSERT INTO sphinx_config ("key", "value") VALUES
('host', '127.0.0.1'),
('port', '9306'),
('username', ''),
('password', ''),
('prefix', '');
SELECT pg_catalog.pg_extension_config_dump('sphinx_config', '');