@oliphaunt/extension-pg-textsearch-linux-x64-gnu 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (25) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +6 -0
  3. package/THIRD_PARTY_NOTICES.md +20 -0
  4. package/extension-contract.json +31 -0
  5. package/package.json +50 -0
  6. package/runtime/lib/modules/pg_textsearch.so +0 -0
  7. package/runtime/lib/postgresql/pg_textsearch.so +0 -0
  8. package/runtime/share/licenses/pg_textsearch/LICENSE +17 -0
  9. package/runtime/share/licenses/pg_textsearch/NOTICE +15 -0
  10. package/runtime/share/postgresql/extension/pg_textsearch--0.0.1--0.0.2.sql +2 -0
  11. package/runtime/share/postgresql/extension/pg_textsearch--0.0.2--0.0.3.sql +2 -0
  12. package/runtime/share/postgresql/extension/pg_textsearch--0.0.3--0.0.4.sql +5 -0
  13. package/runtime/share/postgresql/extension/pg_textsearch--0.0.4--0.0.5.sql +20 -0
  14. package/runtime/share/postgresql/extension/pg_textsearch--0.0.5--0.1.0.sql +42 -0
  15. package/runtime/share/postgresql/extension/pg_textsearch--0.1.0--0.2.0.sql +10 -0
  16. package/runtime/share/postgresql/extension/pg_textsearch--0.2.0--0.3.0.sql +8 -0
  17. package/runtime/share/postgresql/extension/pg_textsearch--0.3.0--0.4.0.sql +8 -0
  18. package/runtime/share/postgresql/extension/pg_textsearch--0.4.0--0.4.1.sql +8 -0
  19. package/runtime/share/postgresql/extension/pg_textsearch--0.4.1--0.4.2.sql +8 -0
  20. package/runtime/share/postgresql/extension/pg_textsearch--0.4.2--0.5.0.sql +8 -0
  21. package/runtime/share/postgresql/extension/pg_textsearch--0.5.0--0.5.1.sql +8 -0
  22. package/runtime/share/postgresql/extension/pg_textsearch--0.5.1.sql +204 -0
  23. package/runtime/share/postgresql/extension/pg_textsearch.control +5 -0
  24. package/share/licenses/pg_textsearch/LICENSE +17 -0
  25. package/share/licenses/pg_textsearch/NOTICE +15 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 oliphaunt-wasix Contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,6 @@
1
+ # @oliphaunt/extension-pg-textsearch-linux-x64-gnu
2
+
3
+ Oliphaunt registry package for the `pg_textsearch` PostgreSQL extension for `linux-x64-gnu`.
4
+
5
+ This package is consumed by `@oliphaunt/ts` when an application opens a database with
6
+ `extensions: ['pg_textsearch']`.
@@ -0,0 +1,20 @@
1
+ # Third-Party Notices
2
+
3
+ Oliphaunt source code in this repository is licensed under the MIT license in
4
+ `LICENSE`.
5
+
6
+ This file is the repository-level notice index. Product-specific runtime and
7
+ packaging notices live next to the product that ships the relevant artifacts:
8
+
9
+ - `src/runtimes/liboliphaunt/native/THIRD_PARTY_NOTICES.md`
10
+ - `src/bindings/wasix-rust/THIRD_PARTY_NOTICES.md`
11
+
12
+ Shared PostgreSQL source pins, third-party source pins, and extension metadata
13
+ are maintained in `src/postgres/versions/18/`, `src/sources/third-party/`, and
14
+ `src/extensions/`. Generated release artifacts must include the notices and
15
+ exact pinned license bytes for every product and third-party component they
16
+ ship.
17
+
18
+ Canonical runtime license snapshots live in
19
+ `src/runtimes/liboliphaunt/licenses/`; their source pins and digests are
20
+ enforced by `tools/release/release-notices.mjs`.
@@ -0,0 +1,31 @@
1
+ {
2
+ "schema": "oliphaunt-npm-extension-contract-v1",
3
+ "product": "oliphaunt-extension-pg-textsearch",
4
+ "version": "0.1.0",
5
+ "family": "native",
6
+ "target": "linux-x64-gnu",
7
+ "members": [
8
+ {
9
+ "sqlName": "pg_textsearch",
10
+ "createsExtension": true,
11
+ "nativeModuleStem": "pg_textsearch",
12
+ "dependencies": [],
13
+ "dataFiles": [],
14
+ "extensionSqlFileNames": [],
15
+ "extensionSqlFilePrefixes": [],
16
+ "sharedPreloadLibraries": [],
17
+ "licenseFiles": [
18
+ {
19
+ "path": "share/licenses/pg_textsearch/LICENSE",
20
+ "sha256": "d33de21a123ce25b41722a5d10750984cb9c844c4d9b01add9e1b31f3ff452e5",
21
+ "mode": "0644"
22
+ },
23
+ {
24
+ "path": "share/licenses/pg_textsearch/NOTICE",
25
+ "sha256": "ff70cf4336c579957368a71c6b6b66ee8954011deef2b3d2c7a11f931080851d",
26
+ "mode": "0644"
27
+ }
28
+ ]
29
+ }
30
+ ]
31
+ }
package/package.json ADDED
@@ -0,0 +1,50 @@
1
+ {
2
+ "name": "@oliphaunt/extension-pg-textsearch-linux-x64-gnu",
3
+ "version": "0.1.0",
4
+ "description": "linux-x64-gnu Oliphaunt extension runtime package for PostgreSQL pg_textsearch.",
5
+ "license": "MIT AND PostgreSQL",
6
+ "type": "module",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "git+https://github.com/f0rr0/oliphaunt.git"
10
+ },
11
+ "os": [
12
+ "linux"
13
+ ],
14
+ "cpu": [
15
+ "x64"
16
+ ],
17
+ "libc": [
18
+ "glibc"
19
+ ],
20
+ "optional": true,
21
+ "oliphaunt": {
22
+ "product": "oliphaunt-extension-pg-textsearch",
23
+ "kind": "exact-extension-target",
24
+ "sqlName": "pg_textsearch",
25
+ "members": [
26
+ "pg_textsearch"
27
+ ],
28
+ "extensionContract": "extension-contract.json",
29
+ "target": "linux-x64-gnu",
30
+ "runtimeRelativePath": "runtime",
31
+ "liboliphauntVersion": "0.1.0",
32
+ "moduleRelativePath": "runtime/lib/modules"
33
+ },
34
+ "publishConfig": {
35
+ "access": "public",
36
+ "provenance": true
37
+ },
38
+ "files": [
39
+ "runtime",
40
+ "extension-contract.json",
41
+ "README.md",
42
+ "LICENSE",
43
+ "THIRD_PARTY_NOTICES.md",
44
+ "share/licenses/**"
45
+ ],
46
+ "exports": {
47
+ "./extension-contract": "./extension-contract.json",
48
+ "./package.json": "./package.json"
49
+ }
50
+ }
@@ -0,0 +1,17 @@
1
+ The PostgreSQL License
2
+
3
+ Permission to use, copy, modify, and distribute this software and its
4
+ documentation for any purpose, without fee, and without a written agreement
5
+ is hereby granted, provided that the above copyright notice and this paragraph
6
+ and the following two paragraphs appear in all copies.
7
+
8
+ IN NO EVENT SHALL TIGER DATA BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT,
9
+ SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS, ARISING
10
+ OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF TIGER DATA HAS
11
+ BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
12
+
13
+ TIGER DATA SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
14
+ THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
15
+ THE SOFTWARE PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND TIGER DATA HAS NO
16
+ OBLIGATIONS TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR
17
+ MODIFICATIONS.
@@ -0,0 +1,15 @@
1
+ pg_textsearch by Tiger Data (TM)
2
+
3
+ Copyright (c) 2025-2026 Timescale, Inc. d/b/a Tiger Data. All Rights Reserved.
4
+
5
+ Licensed under the PostgreSQL License (the "License");
6
+ you may not use this file except in compliance with the License.
7
+ You may obtain a copy of the License at
8
+
9
+ https://github.com/timescale/pg_textsearch/blob/main/LICENSE
10
+
11
+ Unless required by applicable law or agreed to in writing, software
12
+ distributed under the License is distributed on an "AS IS" BASIS,
13
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ See the License for the specific language governing permissions and
15
+ limitations under the License.
@@ -0,0 +1,2 @@
1
+ -- pg_textsearch extension upgrade from version 0.0.1 to 0.0.2
2
+ -- No schema changes required between these versions
@@ -0,0 +1,2 @@
1
+ -- pg_textsearch extension upgrade from version 0.0.2 to 0.0.3
2
+ -- No schema changes required between these versions
@@ -0,0 +1,5 @@
1
+ -- Upgrade from pg_textsearch 0.0.3 to 0.0.4
2
+ --
3
+ -- This release includes bug fixes and improvements but no schema changes.
4
+
5
+ -- No changes required for upgrade
@@ -0,0 +1,20 @@
1
+ -- Upgrade from 0.0.4 to 0.0.5
2
+
3
+ -- Function to force segment write (spill memtable to disk)
4
+ CREATE FUNCTION bm25_spill_index(index_name text)
5
+ RETURNS int4
6
+ AS 'MODULE_PATHNAME', 'tp_spill_memtable'
7
+ LANGUAGE C VOLATILE STRICT;
8
+
9
+ -- Drop old debug function and create new one with simpler name
10
+ DROP FUNCTION IF EXISTS bm25_debug_dump_index(text, boolean);
11
+
12
+ -- Single argument version returns truncated output as text
13
+ CREATE FUNCTION bm25_dump_index(text) RETURNS text
14
+ AS 'MODULE_PATHNAME', 'tp_dump_index'
15
+ LANGUAGE C STRICT STABLE;
16
+
17
+ -- Two argument version writes full dump (with hex) to file
18
+ CREATE FUNCTION bm25_dump_index(text, text) RETURNS text
19
+ AS 'MODULE_PATHNAME', 'tp_dump_index'
20
+ LANGUAGE C STRICT STABLE;
@@ -0,0 +1,42 @@
1
+ -- Upgrade from 0.0.5 to 0.1.0
2
+
3
+ -- Create the new scoring functions with bm25_ prefix
4
+ CREATE FUNCTION bm25_text_bm25query_score(left_text text, right_query bm25query)
5
+ RETURNS float8
6
+ AS 'MODULE_PATHNAME', 'bm25_text_bm25query_score'
7
+ LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE COST 1000;
8
+
9
+ CREATE FUNCTION bm25_text_text_score(text, text) RETURNS float8
10
+ AS 'MODULE_PATHNAME', 'bm25_text_text_score'
11
+ LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE COST 1000;
12
+
13
+ -- Drop the operator class first (it depends on the operator)
14
+ -- Note: Users must rebuild their indexes after this upgrade
15
+ DROP OPERATOR CLASS IF EXISTS text_bm25_ops USING bm25 CASCADE;
16
+
17
+ -- Drop the old operators
18
+ DROP OPERATOR IF EXISTS <@> (text, bm25query);
19
+ DROP OPERATOR IF EXISTS <@> (text, text);
20
+
21
+ -- Drop the old functions
22
+ DROP FUNCTION IF EXISTS text_bm25query_score(text, bm25query);
23
+ DROP FUNCTION IF EXISTS text_text_score(text, text);
24
+
25
+ -- Create new operators with the bm25_ prefixed functions
26
+ CREATE OPERATOR <@> (
27
+ LEFTARG = text,
28
+ RIGHTARG = bm25query,
29
+ PROCEDURE = bm25_text_bm25query_score
30
+ );
31
+
32
+ CREATE OPERATOR <@> (
33
+ LEFTARG = text,
34
+ RIGHTARG = text,
35
+ PROCEDURE = bm25_text_text_score
36
+ );
37
+
38
+ -- Recreate the operator class with the new functions
39
+ CREATE OPERATOR CLASS text_bm25_ops
40
+ DEFAULT FOR TYPE text USING bm25 AS
41
+ OPERATOR 1 <@> (text, bm25query) FOR ORDER BY float_ops,
42
+ FUNCTION 8 (text, bm25query) bm25_text_bm25query_score(text, bm25query);
@@ -0,0 +1,10 @@
1
+ -- Upgrade from 0.1.0 to 0.2.0
2
+ -- No schema changes - internal storage format improvements only
3
+ -- IMPORTANT: Requires REINDEX for existing indexes to use V2 segment format
4
+
5
+ DO $$
6
+ BEGIN
7
+ RAISE INFO 'pg_textsearch upgraded to v0.2.0';
8
+ RAISE INFO 'Run REINDEX on bm25 indexes to use new V2 segment format';
9
+ END
10
+ $$;
@@ -0,0 +1,8 @@
1
+ -- Upgrade from 0.2.0 to 0.3.0
2
+ -- No schema changes
3
+
4
+ DO $$
5
+ BEGIN
6
+ RAISE INFO 'pg_textsearch upgraded to v0.3.0';
7
+ END
8
+ $$;
@@ -0,0 +1,8 @@
1
+ -- Upgrade from 0.3.0 to 0.4.0
2
+ -- No schema changes
3
+
4
+ DO $$
5
+ BEGIN
6
+ RAISE INFO 'pg_textsearch upgraded to v0.4.0';
7
+ END
8
+ $$;
@@ -0,0 +1,8 @@
1
+ -- Upgrade from 0.4.0 to 0.4.1
2
+ -- No schema changes
3
+
4
+ DO $$
5
+ BEGIN
6
+ RAISE INFO 'pg_textsearch upgraded to v0.4.1';
7
+ END
8
+ $$;
@@ -0,0 +1,8 @@
1
+ -- Upgrade from 0.4.1 to 0.4.2
2
+ -- No schema changes
3
+
4
+ DO $$
5
+ BEGIN
6
+ RAISE INFO 'pg_textsearch upgraded to v0.4.2';
7
+ END
8
+ $$;
@@ -0,0 +1,8 @@
1
+ -- Upgrade from 0.4.2 to 0.5.0
2
+ -- No schema changes
3
+
4
+ DO $$
5
+ BEGIN
6
+ RAISE INFO 'pg_textsearch upgraded to v0.5.0';
7
+ END
8
+ $$;
@@ -0,0 +1,8 @@
1
+ -- Upgrade from 0.5.0 to 0.5.1
2
+ -- No schema changes
3
+
4
+ DO $$
5
+ BEGIN
6
+ RAISE WARNING 'pg_textsearch v0.5.1 is a prerelease. Do not use in production.';
7
+ END
8
+ $$;
@@ -0,0 +1,204 @@
1
+ -- pg_textsearch extension version 0.5.1
2
+
3
+ -- complain if script is sourced in psql, rather than via CREATE EXTENSION
4
+ \echo Use "CREATE EXTENSION pg_textsearch" to load this file. \quit
5
+
6
+ -- Access method
7
+
8
+ CREATE FUNCTION tp_handler(internal)
9
+ RETURNS index_am_handler
10
+ AS 'MODULE_PATHNAME', 'tp_handler'
11
+ LANGUAGE C;
12
+
13
+ CREATE ACCESS METHOD bm25 TYPE INDEX HANDLER tp_handler;
14
+
15
+ -- bm25vector type
16
+
17
+ CREATE FUNCTION bm25vector_in(cstring)
18
+ RETURNS bm25vector
19
+ AS 'MODULE_PATHNAME', 'tpvector_in'
20
+ LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
21
+
22
+ CREATE FUNCTION bm25vector_out(bm25vector)
23
+ RETURNS cstring
24
+ AS 'MODULE_PATHNAME', 'tpvector_out'
25
+ LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
26
+
27
+ CREATE FUNCTION bm25vector_recv(internal)
28
+ RETURNS bm25vector
29
+ AS 'MODULE_PATHNAME', 'tpvector_recv'
30
+ LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
31
+
32
+ CREATE FUNCTION bm25vector_send(bm25vector)
33
+ RETURNS bytea
34
+ AS 'MODULE_PATHNAME', 'tpvector_send'
35
+ LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
36
+
37
+ CREATE TYPE bm25vector (
38
+ INPUT = bm25vector_in,
39
+ OUTPUT = bm25vector_out,
40
+ RECEIVE = bm25vector_recv,
41
+ SEND = bm25vector_send,
42
+ STORAGE = extended,
43
+ ALIGNMENT = int4
44
+ );
45
+
46
+ -- bm25query type
47
+
48
+ CREATE FUNCTION bm25query_in(cstring)
49
+ RETURNS bm25query
50
+ AS 'MODULE_PATHNAME', 'tpquery_in'
51
+ LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
52
+
53
+ CREATE FUNCTION bm25query_out(bm25query)
54
+ RETURNS cstring
55
+ AS 'MODULE_PATHNAME', 'tpquery_out'
56
+ LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
57
+
58
+ CREATE FUNCTION bm25query_recv(internal)
59
+ RETURNS bm25query
60
+ AS 'MODULE_PATHNAME', 'tpquery_recv'
61
+ LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
62
+
63
+ CREATE FUNCTION bm25query_send(bm25query)
64
+ RETURNS bytea
65
+ AS 'MODULE_PATHNAME', 'tpquery_send'
66
+ LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
67
+
68
+ CREATE TYPE bm25query (
69
+ INPUT = bm25query_in,
70
+ OUTPUT = bm25query_out,
71
+ RECEIVE = bm25query_recv,
72
+ SEND = bm25query_send,
73
+ STORAGE = extended,
74
+ ALIGNMENT = int4
75
+ );
76
+
77
+ -- Convert text to bm25query
78
+ CREATE FUNCTION to_bm25query(input_text text)
79
+ RETURNS bm25query
80
+ AS 'MODULE_PATHNAME', 'to_tpquery_text'
81
+ LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
82
+
83
+ CREATE FUNCTION to_bm25query(input_text text, index_name text)
84
+ RETURNS bm25query
85
+ AS 'MODULE_PATHNAME', 'to_tpquery_text_index'
86
+ LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
87
+
88
+
89
+ -- Equality function: bm25vector = bm25vector → boolean
90
+ CREATE FUNCTION bm25vector_eq(bm25vector, bm25vector)
91
+ RETURNS boolean
92
+ AS 'MODULE_PATHNAME', 'tpvector_eq'
93
+ LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
94
+
95
+ -- Create the = operator for equality
96
+ CREATE OPERATOR = (
97
+ LEFTARG = bm25vector,
98
+ RIGHTARG = bm25vector,
99
+ FUNCTION = bm25vector_eq,
100
+ COMMUTATOR = =,
101
+ HASHES
102
+ );
103
+
104
+
105
+ -- BM25 scoring function for text <@> bm25query operations
106
+ --
107
+ -- COST 1000: Standalone scoring is expensive. Each call parses document text
108
+ -- with to_tsvector (~14μs per doc), opens the index, looks up IDF values, and
109
+ -- calculates BM25 scores. High cost helps planner prefer index scans.
110
+ CREATE FUNCTION bm25_text_bm25query_score(left_text text, right_query bm25query)
111
+ RETURNS float8
112
+ AS 'MODULE_PATHNAME', 'bm25_text_bm25query_score'
113
+ LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE COST 1000;
114
+
115
+ -- bm25query equality function
116
+ CREATE FUNCTION bm25query_eq(bm25query, bm25query)
117
+ RETURNS boolean
118
+ AS 'MODULE_PATHNAME', 'tpquery_eq'
119
+ LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
120
+
121
+
122
+
123
+ -- <@> operator for text <@> bm25query operations
124
+ CREATE OPERATOR <@> (
125
+ LEFTARG = text,
126
+ RIGHTARG = bm25query,
127
+ PROCEDURE = bm25_text_bm25query_score
128
+ );
129
+
130
+ -- Function for text <@> text operator (planner hook rewrites to text <@> bm25query)
131
+ -- COST 1000: High cost makes planner prefer index scans over seq scan + sort.
132
+ -- In practice, this function errors without index scan context, but the cost
133
+ -- helps the planner choose the right path before execution.
134
+ CREATE FUNCTION bm25_text_text_score(text, text) RETURNS float8
135
+ AS 'MODULE_PATHNAME', 'bm25_text_text_score'
136
+ LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE COST 1000;
137
+
138
+ -- Stub function returning cached score from index scan.
139
+ -- The planner hook replaces resjunk ORDER BY expressions with calls to this
140
+ -- function, avoiding expensive re-computation of BM25 scores.
141
+ CREATE FUNCTION bm25_get_current_score() RETURNS float8
142
+ AS 'MODULE_PATHNAME', 'bm25_get_current_score'
143
+ LANGUAGE C VOLATILE STRICT PARALLEL SAFE;
144
+
145
+ -- <@> operator for text <@> text operations (implicit index resolution)
146
+ -- The planner hook transforms this to text <@> bm25query when a BM25 index exists
147
+ CREATE OPERATOR <@> (
148
+ LEFTARG = text,
149
+ RIGHTARG = text,
150
+ PROCEDURE = bm25_text_text_score
151
+ );
152
+
153
+ -- = operator for bm25query equality
154
+ CREATE OPERATOR = (
155
+ LEFTARG = bm25query,
156
+ RIGHTARG = bm25query,
157
+ FUNCTION = bm25query_eq,
158
+ COMMUTATOR = =,
159
+ HASHES
160
+ );
161
+
162
+ -- bm25 operator class for text columns
163
+ -- The planner hook rewrites text <@> text to text <@> bm25query, so we only
164
+ -- need to register the bm25query operator and support function here.
165
+ CREATE OPERATOR CLASS text_bm25_ops
166
+ DEFAULT FOR TYPE text USING bm25 AS
167
+ OPERATOR 1 <@> (text, bm25query) FOR ORDER BY float_ops,
168
+ FUNCTION 8 (text, bm25query) bm25_text_bm25query_score(text, bm25query);
169
+
170
+ -- Debug function to dump index contents (memtable and segments)
171
+ -- Single argument version returns truncated output as text
172
+ CREATE FUNCTION bm25_dump_index(text) RETURNS text
173
+ AS 'MODULE_PATHNAME', 'tp_dump_index'
174
+ LANGUAGE C STRICT STABLE;
175
+
176
+ -- Two argument version writes full dump (with hex) to file
177
+ CREATE FUNCTION bm25_dump_index(text, text) RETURNS text
178
+ AS 'MODULE_PATHNAME', 'tp_dump_index'
179
+ LANGUAGE C STRICT STABLE;
180
+
181
+ -- Display version info (with prerelease warning)
182
+ DO $$
183
+ BEGIN
184
+ RAISE WARNING 'pg_textsearch v0.5.1 is a prerelease. Do not use in production.';
185
+ END
186
+ $$;
187
+
188
+ -- Function to force segment write (spill memtable to disk)
189
+ CREATE FUNCTION bm25_spill_index(index_name text)
190
+ RETURNS int4
191
+ AS 'MODULE_PATHNAME', 'tp_spill_memtable'
192
+ LANGUAGE C VOLATILE STRICT;
193
+
194
+ -- Fast summary function showing only statistics (no content dump)
195
+ CREATE FUNCTION bm25_summarize_index(text) RETURNS text
196
+ AS 'MODULE_PATHNAME', 'tp_summarize_index'
197
+ LANGUAGE C STRICT STABLE;
198
+
199
+ -- Page visualization - dumps ANSI-colored page layout to file
200
+ -- Shows page types: M=meta R=recovery H=header d=dict p=post s=skip m=docmap i=idx .=empty
201
+ -- Colors indicate segment level (cyan=L0, yellow=L1, green=L2, magenta=L3+)
202
+ CREATE FUNCTION bm25_debug_pageviz(index_name text, filepath text) RETURNS text
203
+ AS 'MODULE_PATHNAME', 'tp_debug_pageviz'
204
+ LANGUAGE C STRICT STABLE;
@@ -0,0 +1,5 @@
1
+ # pg_textsearch extension
2
+ comment = 'Full-text search with BM25 ranking'
3
+ default_version = '0.5.1'
4
+ module_pathname = '$libdir/pg_textsearch'
5
+ relocatable = true
@@ -0,0 +1,17 @@
1
+ The PostgreSQL License
2
+
3
+ Permission to use, copy, modify, and distribute this software and its
4
+ documentation for any purpose, without fee, and without a written agreement
5
+ is hereby granted, provided that the above copyright notice and this paragraph
6
+ and the following two paragraphs appear in all copies.
7
+
8
+ IN NO EVENT SHALL TIGER DATA BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT,
9
+ SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS, ARISING
10
+ OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF TIGER DATA HAS
11
+ BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
12
+
13
+ TIGER DATA SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
14
+ THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
15
+ THE SOFTWARE PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND TIGER DATA HAS NO
16
+ OBLIGATIONS TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR
17
+ MODIFICATIONS.
@@ -0,0 +1,15 @@
1
+ pg_textsearch by Tiger Data (TM)
2
+
3
+ Copyright (c) 2025-2026 Timescale, Inc. d/b/a Tiger Data. All Rights Reserved.
4
+
5
+ Licensed under the PostgreSQL License (the "License");
6
+ you may not use this file except in compliance with the License.
7
+ You may obtain a copy of the License at
8
+
9
+ https://github.com/timescale/pg_textsearch/blob/main/LICENSE
10
+
11
+ Unless required by applicable law or agreed to in writing, software
12
+ distributed under the License is distributed on an "AS IS" BASIS,
13
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ See the License for the specific language governing permissions and
15
+ limitations under the License.