alchemy-pg_search 6.0.0 → 7.4.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: '009bedc83da970afa4e20ea64375695711b50ef37027b4e4cbe08a7add274070'
4
- data.tar.gz: c324b6915704b0ef189d539510d57ff80962be5f6244907bbfd9d82e0d13eec8
3
+ metadata.gz: 9e00888216dd93910987461a26a8638880587c9ada33cf2406216dea03e05554
4
+ data.tar.gz: 8c96b6b2bafec9df42017106b016587d62c51b33d462c0674218b39d06168033
5
5
  SHA512:
6
- metadata.gz: 0eda59775b10f840a97362c244beb387e259e104d18f03e855984ea15437649d78c1a397a4a2f443e62c62bbd74f42288b77ce7ede6401d090ae28b1d3844d06
7
- data.tar.gz: 6245d3b156a31fe0459fc9372de9c3ffc8ab7f123dd717402a7dc3aeb206876912069f88ae4d20a127039ee1754d45f87c6391633490f8363dde101a2cb8fb10
6
+ metadata.gz: 19e2ac77874ac9a99110419d813f907ee8895f83cfc91140bf3c4af9451e95a722e10e5a87a3379caa30e65bff2c3ba6314e0fe7f719aec5029bd231638de00d
7
+ data.tar.gz: 7465ebc5e8b3080a3551e686ac31917da67bdd226ebe8e9aee49d15259b2eaa562f7d7ea6f97f387139e94cf28f48f91193af5afc0c0f1c2a7d2117c4c9dd1d6
@@ -1,12 +1,26 @@
1
1
  name: CI
2
2
 
3
- on: [push, pull_request]
3
+ concurrency:
4
+ group: ${{ github.workflow }}-${{ github.ref_name }}
5
+ cancel-in-progress: ${{ github.ref_name != 'main' }}
6
+
7
+ on:
8
+ push:
9
+ branches:
10
+ - main
11
+ pull_request:
4
12
 
5
13
  jobs:
6
14
  RSpec:
7
15
  runs-on: ubuntu-latest
16
+ strategy:
17
+ fail-fast: false
18
+ matrix:
19
+ ruby: ["3.2", "3.4"]
20
+ alchemy_cms: ["7.4"]
8
21
  env:
9
22
  RAILS_ENV: test
23
+ ALCHEMY_CMS_VERSION: ${{ matrix.alchemy_cms }}
10
24
  services:
11
25
  postgres:
12
26
  image: postgres:12
@@ -18,10 +32,12 @@ jobs:
18
32
  options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
19
33
  steps:
20
34
  - uses: actions/checkout@v2.3.4
35
+ - name: Install ImageMagick
36
+ run: sudo apt-get install -y imagemagick
21
37
  - name: Set up Ruby
22
38
  uses: ruby/setup-ruby@v1
23
39
  with:
24
- ruby-version: 3.2
40
+ ruby-version: ${{ matrix.ruby }}
25
41
  bundler-cache: true
26
42
  - name: Prepare database
27
43
  run: bundle exec rake alchemy:spec:prepare
@@ -0,0 +1,27 @@
1
+ name: Post Release
2
+
3
+ on:
4
+ workflow_dispatch:
5
+ inputs:
6
+ target_branch:
7
+ description: 'Target branch (e.g., main, 8.0-stable)'
8
+ required: true
9
+ default: 'main'
10
+ type: string
11
+ repository_dispatch:
12
+ types: [post-release]
13
+
14
+ jobs:
15
+ post-release:
16
+ uses: AlchemyCMS/.github/.github/workflows/post-release.yml@main
17
+ with:
18
+ version_file_path: lib/alchemy/pg_search/version.rb
19
+ target_branch: ${{ github.event.client_payload.target_branch || inputs.target_branch }}
20
+ secrets:
21
+ app_id: ${{ vars.ALCHEMY_BOT_APP_ID }}
22
+ app_private_key: ${{ secrets.ALCHEMY_BOT_APP_PRIVATE_KEY }}
23
+ slack_webhook_url: ${{ secrets.SLACK_WEBHOOK_URL }}
24
+ mastodon_access_token: ${{ secrets.MASTODON_ACCESS_TOKEN }}
25
+ mastodon_instance: ${{ secrets.MASTODON_INSTANCE }}
26
+ bluesky_identifier: ${{ secrets.BLUESKY_IDENTIFIER }}
27
+ bluesky_password: ${{ secrets.BLUESKY_PASSWORD }}
@@ -0,0 +1,25 @@
1
+ name: Prepare Release
2
+
3
+ on:
4
+ workflow_dispatch:
5
+ inputs:
6
+ bump:
7
+ description: 'Version bump type. Choose "release" for finalizing a pre-release, or patch/minor/major to bump version.'
8
+ required: true
9
+ type: choice
10
+ default: 'patch'
11
+ options:
12
+ - release
13
+ - patch
14
+ - minor
15
+ - major
16
+
17
+ jobs:
18
+ prepare:
19
+ uses: AlchemyCMS/.github/.github/workflows/prepare-release.yml@main
20
+ with:
21
+ version_file_path: lib/alchemy/pg_search/version.rb
22
+ bump: ${{ inputs.bump }}
23
+ secrets:
24
+ app_id: ${{ vars.ALCHEMY_BOT_APP_ID }}
25
+ app_private_key: ${{ secrets.ALCHEMY_BOT_APP_PRIVATE_KEY }}
@@ -0,0 +1,20 @@
1
+ name: Publish Release
2
+
3
+ on:
4
+ workflow_dispatch:
5
+ pull_request:
6
+ types: [closed]
7
+ branches:
8
+ - main
9
+
10
+ jobs:
11
+ publish:
12
+ if: github.event_name == 'workflow_dispatch' || (github.event.pull_request.merged == true && startsWith(github.event.pull_request.head.ref, 'release/v'))
13
+ uses: AlchemyCMS/.github/.github/workflows/release.yml@main
14
+ with:
15
+ version_file_path: lib/alchemy/pg_search/version.rb
16
+ target_branch: ${{ github.event.pull_request.base.ref || github.ref_name }}
17
+ secrets:
18
+ app_id: ${{ vars.ALCHEMY_BOT_APP_ID }}
19
+ app_private_key: ${{ secrets.ALCHEMY_BOT_APP_PRIVATE_KEY }}
20
+ rubygems_api_key: ${{ secrets.RUBYGEMS_API_KEY }}
data/CHANGELOG.md CHANGED
@@ -1,5 +1,23 @@
1
1
  # Changelog
2
2
 
3
+ ## 7.4.0 (2026-03-17)
4
+
5
+ ## What's Changed
6
+ * Add reusable release workflows by @tvdeyen in https://github.com/AlchemyCMS/alchemy-pg_search/pull/64
7
+ * Pass rubygems_api_key secret to release workflow by @tvdeyen in https://github.com/AlchemyCMS/alchemy-pg_search/pull/65
8
+ * Update Alchemy to v7.4.x by @sascha-karnatz in https://github.com/AlchemyCMS/alchemy-pg_search/pull/68
9
+
10
+
11
+ **Full Changelog**: https://github.com/AlchemyCMS/alchemy-pg_search/compare/v6.1.0...v7.4.0
12
+
13
+ ## [v6.1.0](https://github.com/AlchemyCMS/alchemy-pg_search/tree/v6.1.0) (2024-12-13)
14
+
15
+ [Full Changelog](https://github.com/AlchemyCMS/alchemy-pg_search/compare/v6.0.0...v6.1.0)
16
+
17
+ **Merged pull requests:**
18
+
19
+ - Use PgSearch::Document.rebuild for page reindex [\#63](https://github.com/AlchemyCMS/alchemy-pg_search/pull/63) ([sascha-karnatz](https://github.com/sascha-karnatz))
20
+
3
21
  ## [v6.0.0](https://github.com/AlchemyCMS/alchemy-pg_search/tree/v6.0.0) (2024-12-03)
4
22
 
5
23
  [Full Changelog](https://github.com/AlchemyCMS/alchemy-pg_search/compare/v5.2.0...v6.0.0)
data/Gemfile CHANGED
@@ -3,7 +3,7 @@ source "https://rubygems.org"
3
3
  gemspec
4
4
 
5
5
  gem "rails", "~> 7.1.0"
6
- gem "alchemy_cms", "~> 7.0.0"
6
+ gem "alchemy_cms", "~> #{ENV.fetch("ALCHEMY_CMS_VERSION", "7.4")}.0"
7
7
 
8
8
  gem "sassc-rails"
9
9
  gem "sassc", "~> 2.4.0"
@@ -11,7 +11,7 @@ gem "pg", "~> 1.0"
11
11
  gem "puma"
12
12
 
13
13
  group :test do
14
- gem "factory_bot_rails", "~> 4.8.0"
14
+ gem "factory_bot_rails", "~> 6.5.1"
15
15
  gem "capybara"
16
16
  gem "pry-byebug"
17
17
  gem "launchy"
data/README.md CHANGED
@@ -209,6 +209,19 @@ en:
209
209
 
210
210
  ## Upgrading
211
211
 
212
+ ## 6.0
213
+
214
+ Upgrading to 6.0 makes it necessary to update you search result partials.
215
+
216
+ Make sure to use `Alchemy::Search::SearchPage.perform_search(params, ability: current_ability)` and pass the `search_results` into `alchemy/search/results` (or whatever partial you are rendering the results) and make sure to use the local `search_results` variable over the `@search_results` instance variable.
217
+
218
+ ```diff
219
+ -<%= render "alchemy/search/results" %>
220
+ +<%= render "alchemy/search/results", search_results: Alchemy::Search::SearchPage.perform_search(params, ability: current_ability) %>
221
+ ```
222
+
223
+ ## 4.0
224
+
212
225
  If you are upgrading from v3.0.0 please run the install generator:
213
226
 
214
227
  ```shell
@@ -18,7 +18,7 @@ Gem::Specification.new do |spec|
18
18
  spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^spec/}) }
19
19
  spec.require_paths = ["lib"]
20
20
 
21
- spec.add_runtime_dependency "alchemy_cms", [">= 7.0", "< 8"]
21
+ spec.add_runtime_dependency "alchemy_cms", [">= 7.4", "< 8"]
22
22
  spec.add_runtime_dependency "pg_search", ["~> 2.1"]
23
23
  spec.add_runtime_dependency "pg"
24
24
 
@@ -6,24 +6,18 @@ module Alchemy::PgSearch::PageExtension
6
6
  base.after_save :remove_unpublished_page
7
7
  base.multisearchable(
8
8
  against: [
9
- :meta_description,
10
- :meta_keywords,
11
9
  :name,
10
+ :searchable_content
12
11
  ],
13
12
  additional_attributes: ->(page) { { page_id: page.id, searchable_created_at: page.public_on } },
14
13
  if: :searchable?,
15
14
  )
16
15
  end
17
16
 
18
- def searchable?
19
- (definition.key?(:searchable) ? definition[:searchable] : true) &&
20
- searchable && public? && !layoutpage?
21
- end
22
-
23
17
  private
24
18
 
25
19
  def remove_unpublished_page
26
- Alchemy::PgSearch.remove_page(self) unless searchable?
20
+ ::PgSearch::Document.delete_by(page_id: id) unless searchable?
27
21
  end
28
22
  end
29
23
 
@@ -10,6 +10,10 @@ module Alchemy::Search::ElementExtension
10
10
  def searchable?
11
11
  searchable && public? && page.searchable? && page_version.public?
12
12
  end
13
+
14
+ def searchable_content
15
+ ingredients.select(&:searchable?).map(&:searchable_content).join(" ").squish
16
+ end
13
17
  end
14
18
 
15
19
  Alchemy::Element.prepend(Alchemy::Search::ElementExtension)
@@ -5,6 +5,10 @@ module Alchemy::Search::PageExtension
5
5
  (definition.key?(:searchable) ? definition[:searchable] : true) &&
6
6
  searchable && public? && !layoutpage?
7
7
  end
8
+
9
+ def searchable_content
10
+ all_elements.includes(ingredients: {element: :page}).map(&:searchable_content).join(" ")
11
+ end
8
12
  end
9
13
 
10
14
  Alchemy::Page.prepend(Alchemy::Search::PageExtension)
@@ -2,7 +2,7 @@ module Alchemy
2
2
  module PgSearch
3
3
  class IndexPageJob < BaseJob
4
4
  def perform(page)
5
- PgSearch.index_page(page)
5
+ page.update_pg_search_document
6
6
  end
7
7
  end
8
8
  end
@@ -1,5 +1,5 @@
1
1
  module Alchemy
2
2
  module PgSearch
3
- VERSION = "6.0.0"
3
+ VERSION = "7.4.0"
4
4
  end
5
5
  end
@@ -17,37 +17,13 @@ module Alchemy
17
17
  extend Config
18
18
 
19
19
  ##
20
- # index all supported Alchemy pages
21
- def self.rebuild
22
- ActiveRecord::Base.transaction do
23
- ::PgSearch::Document.delete_all
24
- Alchemy::Page.all.each{ |page| index_page(page) }
25
- end
26
- end
27
-
28
- ##
29
- # remove the whole index for the page
30
- #
31
- # @param page [Alchemy::Page]
32
- def self.remove_page(page)
33
- ::PgSearch::Document.delete_by(page_id: page.id)
34
- end
35
-
36
- ##
37
- # index a single page and indexable ingredients
38
- #
39
- # @param page [Alchemy::Page]
40
- def self.index_page(page)
41
- page.update_pg_search_document
42
-
43
- document = page.pg_search_document
44
- return if document.nil?
45
-
46
- ingredient_content = page.all_elements.includes(ingredients: {element: :page}).map do |element|
47
- element.ingredients.select { |i| i.searchable? }.map(&:searchable_content).join(" ")
48
- end.join(" ")
49
-
50
- document.update_column(:content, "#{document.content} #{ingredient_content}".squish)
20
+ # Reindex all supported Alchemy pages
21
+ def self.rebuild(clean_up: true, transactional: true)
22
+ ::PgSearch::Multisearch.rebuild(
23
+ Alchemy::Page,
24
+ clean_up: clean_up,
25
+ transactional: transactional
26
+ )
51
27
  end
52
28
 
53
29
  ##
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: alchemy-pg_search
3
3
  version: !ruby/object:Gem::Version
4
- version: 6.0.0
4
+ version: 7.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Thomas von Deyen
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2024-12-03 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: alchemy_cms
@@ -16,7 +15,7 @@ dependencies:
16
15
  requirements:
17
16
  - - ">="
18
17
  - !ruby/object:Gem::Version
19
- version: '7.0'
18
+ version: '7.4'
20
19
  - - "<"
21
20
  - !ruby/object:Gem::Version
22
21
  version: '8'
@@ -26,7 +25,7 @@ dependencies:
26
25
  requirements:
27
26
  - - ">="
28
27
  - !ruby/object:Gem::Version
29
- version: '7.0'
28
+ version: '7.4'
30
29
  - - "<"
31
30
  - !ruby/object:Gem::Version
32
31
  version: '8'
@@ -108,6 +107,9 @@ extensions: []
108
107
  extra_rdoc_files: []
109
108
  files:
110
109
  - ".github/workflows/ci.yml"
110
+ - ".github/workflows/post-release.yml"
111
+ - ".github/workflows/prepare-release.yml"
112
+ - ".github/workflows/release.yml"
111
113
  - ".gitignore"
112
114
  - CHANGELOG.md
113
115
  - Gemfile
@@ -144,7 +146,6 @@ homepage: https://alchemy-cms.com
144
146
  licenses:
145
147
  - BSD-3-Clause
146
148
  metadata: {}
147
- post_install_message:
148
149
  rdoc_options: []
149
150
  require_paths:
150
151
  - lib
@@ -160,8 +161,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
160
161
  version: '0'
161
162
  requirements:
162
163
  - PostgreSQL >= 12.x
163
- rubygems_version: 3.4.19
164
- signing_key:
164
+ rubygems_version: 4.0.6
165
165
  specification_version: 4
166
166
  summary: This gem provides PostgreSQL full text search to Alchemy
167
167
  test_files: []