rails-paradedb 0.5.0 → 0.6.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 04a77503859e70b3362f1a5679a2d1b229c62c5c49a0383fbe1164b317d902f2
4
- data.tar.gz: 1ec3bc0ae18c1232ddfc1b67aec6eb3a92dde0285297fa4a45afa7b789ae9d7c
3
+ metadata.gz: 1bcba07642cf33fe747ed6f810374adee776ee014533e64f5b38d490335dd672
4
+ data.tar.gz: a470ac63132444ae93ee893eee869d6dac4641774fe965f6519592a7e5c50d35
5
5
  SHA512:
6
- metadata.gz: e81872356be536dd22423f39c7c8a899630dd5a601d5c54c6a8cbfc2c165ba3aa1c8edbe016a88ff9bc3492fcb0925c35cf31055dbca39de59f05f1b49ce2cec
7
- data.tar.gz: 0c3781ba0d93f5aa4067545354f87e186da71c43fab1a257c9715ce821dfde474549c200d22f9814f75747a687a7e21626148de2b474759bc9317395f413902f
6
+ metadata.gz: aa7193be8a40ed3714b3d17cf1c1b53980b63245a70c878e6aaa164c272df072217eb9c71a808cc29c0dc2611056f7d323f3d6aa9e507b77648beea83a734b6e
7
+ data.tar.gz: 6870426a910699fd8b1b12f7a03402d8157138d2b2aa4c210339356a2ff60299b29301a1a5cc28f64656f4e80479719e0324270dd0f5a9f7668e09ee9654a262
data/CHANGELOG.md CHANGED
@@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file. The format
4
4
 
5
5
  ## [Unreleased]
6
6
 
7
+ ## [0.6.0] - 2026-04-14
8
+
9
+ ### Added
10
+
11
+ - Support concurrent BM25 index creation via `concurrently:` in `create_paradedb_index` and `add_bm25_index`
12
+
7
13
  ## [0.5.0] - 2026-04-14
8
14
 
9
15
  ### Added
@@ -120,7 +126,8 @@ All notable changes to this project will be documented in this file. The format
120
126
  - Schema dump/load round-trip for tokenizer configuration and index options
121
127
  (including `target_segment_count`)
122
128
 
123
- [Unreleased]: https://github.com/paradedb/rails-paradedb/compare/v0.5.0...HEAD
129
+ [Unreleased]: https://github.com/paradedb/rails-paradedb/compare/v0.6.0...HEAD
130
+ [0.6.0]: https://github.com/paradedb/rails-paradedb/releases/tag/v0.6.0
124
131
  [0.5.0]: https://github.com/paradedb/rails-paradedb/releases/tag/v0.5.0
125
132
  [0.4.0]: https://github.com/paradedb/rails-paradedb/releases/tag/v0.4.0
126
133
  [0.3.0]: https://github.com/paradedb/rails-paradedb/releases/tag/v0.3.0
@@ -6,7 +6,7 @@ class <%= migration_class_name %> < ActiveRecord::Migration[<%= ActiveRecord::Mi
6
6
 
7
7
  <% end -%>
8
8
  def up
9
- create_paradedb_index(<%= class_name %>Index, if_not_exists: true)
9
+ create_paradedb_index(<%= class_name %>Index, if_not_exists: true<% if options[:concurrent] %>, concurrently: true<% end %>)
10
10
  end
11
11
 
12
12
  def down
@@ -4,11 +4,15 @@ require_relative "tokenizer_sql"
4
4
 
5
5
  module ParadeDB
6
6
  module MigrationHelpers
7
- def create_paradedb_index(index_klass, if_not_exists: false)
7
+ def create_paradedb_index(index_klass, if_not_exists: false, concurrently: false)
8
8
  ensure_postgresql_adapter!
9
+ if concurrently && transaction_open_for_paradedb?
10
+ raise ArgumentError, "create_paradedb_index concurrently: true cannot run inside a transaction"
11
+ end
12
+
9
13
  resolved = resolve_index_klass(index_klass)
10
14
  compiled = resolved.compiled_definition
11
- execute(build_create_sql(compiled, if_not_exists: if_not_exists))
15
+ execute(build_create_sql(compiled, if_not_exists: if_not_exists, concurrently: concurrently))
12
16
  remember_schema_index_reference(resolved)
13
17
  end
14
18
 
@@ -21,7 +25,7 @@ module ParadeDB
21
25
  remember_schema_index_reference(resolved)
22
26
  end
23
27
 
24
- def add_bm25_index(table, fields:, key_field:, name: nil, index_options: nil, where: nil, if_not_exists: false)
28
+ def add_bm25_index(table, fields:, key_field:, name: nil, index_options: nil, where: nil, if_not_exists: false, concurrently: false)
25
29
  ensure_postgresql_adapter!
26
30
  anonymous = Class.new(ParadeDB::Index)
27
31
  anonymous.table_name = table
@@ -31,7 +35,7 @@ module ParadeDB
31
35
  anonymous.index_options = index_options unless index_options.nil?
32
36
  anonymous.where = where unless where.nil?
33
37
 
34
- create_paradedb_index(anonymous, if_not_exists: if_not_exists)
38
+ create_paradedb_index(anonymous, if_not_exists: if_not_exists, concurrently: concurrently)
35
39
  end
36
40
 
37
41
  def remove_bm25_index(table, name: nil, if_exists: false)
@@ -77,14 +81,15 @@ module ParadeDB
77
81
  ParadeDB.ensure_postgresql_adapter!(self, context: "ParadeDB migration helper")
78
82
  end
79
83
 
80
- def build_create_sql(compiled, if_not_exists:)
84
+ def build_create_sql(compiled, if_not_exists:, concurrently: false)
85
+ modifier = concurrently ? " CONCURRENTLY" : ""
81
86
  prefix = if_not_exists ? "IF NOT EXISTS " : ""
82
87
  fields_sql = compiled.entries.map { |entry| bm25_entry_sql(entry) }.join(", ")
83
88
  with_options_sql = bm25_with_options_sql(compiled)
84
89
  where_sql = compiled.where ? "\nWHERE #{compiled.where}" : ""
85
90
 
86
91
  <<~SQL.strip.gsub(/\s+/, " ")
87
- CREATE INDEX #{prefix}#{quote_table_name(compiled.index_name)} ON #{quote_table_name(compiled.table_name)}
92
+ CREATE INDEX#{modifier} #{prefix}#{quote_table_name(compiled.index_name)} ON #{quote_table_name(compiled.table_name)}
88
93
  USING bm25 (#{fields_sql})
89
94
  WITH (#{with_options_sql})#{where_sql}
90
95
  SQL
@@ -846,15 +851,15 @@ end
846
851
  if defined?(ActiveRecord::Migration)
847
852
  module ParadeDB
848
853
  module MigrationDSL
849
- def create_paradedb_index(index_klass, if_not_exists: false)
850
- connection.create_paradedb_index(index_klass, if_not_exists: if_not_exists)
854
+ def create_paradedb_index(index_klass, if_not_exists: false, concurrently: false)
855
+ connection.create_paradedb_index(index_klass, if_not_exists: if_not_exists, concurrently: concurrently)
851
856
  end
852
857
 
853
858
  def replace_paradedb_index(index_klass)
854
859
  connection.replace_paradedb_index(index_klass)
855
860
  end
856
861
 
857
- def add_bm25_index(table, fields:, key_field:, name: nil, index_options: nil, where: nil, if_not_exists: false)
862
+ def add_bm25_index(table, fields:, key_field:, name: nil, index_options: nil, where: nil, if_not_exists: false, concurrently: false)
858
863
  connection.add_bm25_index(
859
864
  table,
860
865
  fields: fields,
@@ -862,7 +867,8 @@ if defined?(ActiveRecord::Migration)
862
867
  name: name,
863
868
  index_options: index_options,
864
869
  where: where,
865
- if_not_exists: if_not_exists
870
+ if_not_exists: if_not_exists,
871
+ concurrently: concurrently
866
872
  )
867
873
  end
868
874
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ParadeDB
4
- VERSION = "0.5.0"
4
+ VERSION = "0.6.0"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails-paradedb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - ParadeDB