alchemy-pg_search 7.4.0 → 8.2.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: 9e00888216dd93910987461a26a8638880587c9ada33cf2406216dea03e05554
4
- data.tar.gz: 8c96b6b2bafec9df42017106b016587d62c51b33d462c0674218b39d06168033
3
+ metadata.gz: 60537a333404a16b364fc265db62b3a5a9ca50c50e84c98261fe3c663b5125ca
4
+ data.tar.gz: 976c0fa3b5f22cf18afc6f32e7273ad84028a3d3c4a4a4e3cb5a0d5698a94897
5
5
  SHA512:
6
- metadata.gz: 19e2ac77874ac9a99110419d813f907ee8895f83cfc91140bf3c4af9451e95a722e10e5a87a3379caa30e65bff2c3ba6314e0fe7f719aec5029bd231638de00d
7
- data.tar.gz: 7465ebc5e8b3080a3551e686ac31917da67bdd226ebe8e9aee49d15259b2eaa562f7d7ea6f97f387139e94cf28f48f91193af5afc0c0f1c2a7d2117c4c9dd1d6
6
+ metadata.gz: 8de6e63910d56e7b1aad533a81e8af1fa302a46daeda3a0218ded216b550a7972dec6bb9d5a9b016a3eb26446cbae6519f5cb5dcd84059ee06d425334cc84cd2
7
+ data.tar.gz: 001ed6c25e6f36737b6dd8cea5d10829ff734a4559cfaa66818ca94ff1b999bd7d7f925f3085b0ca1e0511c470a1865dc6f264693de337bcbc96333686ace593
data/.backportrc.json ADDED
@@ -0,0 +1,3 @@
1
+ {
2
+ "prTitle": "[{{targetBranch}}] {{sourcePullRequest.title}}"
3
+ }
@@ -0,0 +1,46 @@
1
+ name: Backport
2
+
3
+ on:
4
+ pull_request_target:
5
+ types:
6
+ - closed
7
+ - labeled
8
+
9
+ permissions:
10
+ pull-requests: write
11
+
12
+ jobs:
13
+ backport:
14
+ name: Backport
15
+ runs-on: ubuntu-24.04
16
+ # Only react to merged PRs for security reasons.
17
+ # See https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#pull_request_target.
18
+ if: |
19
+ github.event.pull_request.merged == true
20
+ && contains(
21
+ join(github.event.pull_request.labels.*.name, '---'),
22
+ 'backport'
23
+ )
24
+ && (
25
+ (github.event.action == 'labeled' && startsWith(github.event.label.name, 'backport')) ||
26
+ (github.event.action == 'closed')
27
+ )
28
+ steps:
29
+ - name: Generate token
30
+ id: generate_token
31
+ uses: actions/create-github-app-token@v2
32
+ with:
33
+ app-id: ${{ vars.ALCHEMY_BOT_APP_ID }}
34
+ private-key: ${{ secrets.ALCHEMY_BOT_APP_PRIVATE_KEY }}
35
+ - name: Backport pull request
36
+ uses: sorenlouv/backport-github-action@v9.5.1
37
+ with:
38
+ github_token: ${{ steps.generate_token.outputs.token }}
39
+ auto_backport_label_prefix: backport-to-
40
+ add_original_reviewers: true
41
+ - name: Info log
42
+ if: ${{ success() }}
43
+ run: cat ~/.backport/backport.info.log
44
+ - name: Debug log
45
+ if: ${{ failure() }}
46
+ run: cat ~/.backport/backport.debug.log
@@ -17,7 +17,7 @@ jobs:
17
17
  fail-fast: false
18
18
  matrix:
19
19
  ruby: ["3.2", "3.4"]
20
- alchemy_cms: ["7.4"]
20
+ alchemy_cms: ["8.2"]
21
21
  env:
22
22
  RAILS_ENV: test
23
23
  ALCHEMY_CMS_VERSION: ${{ matrix.alchemy_cms }}
@@ -6,6 +6,7 @@ on:
6
6
  types: [closed]
7
7
  branches:
8
8
  - main
9
+ - '*-stable'
9
10
 
10
11
  jobs:
11
12
  publish:
data/.gitignore CHANGED
@@ -15,3 +15,4 @@ yarn.lock
15
15
 
16
16
  .idea
17
17
  .vscode
18
+ .claude/
data/CHANGELOG.md CHANGED
@@ -1,14 +1,26 @@
1
1
  # Changelog
2
2
 
3
- ## 7.4.0 (2026-03-17)
3
+ ## 8.2.0 (2026-05-22)
4
4
 
5
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
6
+ * Add bin/setup script by @sascha-karnatz in https://github.com/AlchemyCMS/alchemy-pg_search/pull/70
7
+ * Upgrade Alchemy v8.0 by @sascha-karnatz in https://github.com/AlchemyCMS/alchemy-pg_search/pull/69
8
+ * Release v8.0.0 by @alchemycms-bot[bot] in https://github.com/AlchemyCMS/alchemy-pg_search/pull/74
9
+ * Start development of version 8.1.0.dev by @alchemycms-bot[bot] in https://github.com/AlchemyCMS/alchemy-pg_search/pull/75
10
+ * Remove AlchemyCMS deprecations by @sascha-karnatz in https://github.com/AlchemyCMS/alchemy-pg_search/pull/76
11
+ * [8.2-stable] Fix not searchable parent pages by @alchemycms-bot[bot] in https://github.com/AlchemyCMS/alchemy-pg_search/pull/79
9
12
 
10
13
 
11
- **Full Changelog**: https://github.com/AlchemyCMS/alchemy-pg_search/compare/v6.1.0...v7.4.0
14
+ **Full Changelog**: https://github.com/AlchemyCMS/alchemy-pg_search/compare/v7.4.0...v8.2.0
15
+
16
+ ## 8.0.0 (2026-03-17)
17
+
18
+ ## What's Changed
19
+ * Add bin/setup script by @sascha-karnatz in https://github.com/AlchemyCMS/alchemy-pg_search/pull/70
20
+ * Upgrade Alchemy v8.0 by @sascha-karnatz in https://github.com/AlchemyCMS/alchemy-pg_search/pull/69
21
+
22
+
23
+ **Full Changelog**: https://github.com/AlchemyCMS/alchemy-pg_search/compare/v7.4.0...v8.0.0
12
24
 
13
25
  ## [v6.1.0](https://github.com/AlchemyCMS/alchemy-pg_search/tree/v6.1.0) (2024-12-13)
14
26
 
data/Gemfile CHANGED
@@ -2,8 +2,8 @@ source "https://rubygems.org"
2
2
 
3
3
  gemspec
4
4
 
5
- gem "rails", "~> 7.1.0"
6
- gem "alchemy_cms", "~> #{ENV.fetch("ALCHEMY_CMS_VERSION", "7.4")}.0"
5
+ gem "rails", "~> 8.1.0"
6
+ gem "alchemy_cms", "~> #{ENV.fetch("ALCHEMY_CMS_VERSION", "8.2")}.0"
7
7
 
8
8
  gem "sassc-rails"
9
9
  gem "sassc", "~> 2.4.0"
data/README.md CHANGED
@@ -236,6 +236,16 @@ and reindex your database in your Rails console
236
236
  $ Alchemy::PgSearch.rebuild
237
237
  ```
238
238
 
239
+ ## Local Development
240
+
241
+ Run the setup script to install dependencies and prepare the dummy app:
242
+
243
+ ```shell
244
+ $ bin/setup
245
+ ```
246
+
247
+ This installs gems, runs the Alchemy and PgSearch installers, and clears temporary files.
248
+
239
249
  ## Contributing
240
250
 
241
251
  1. Fork it
@@ -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.4", "< 8"]
21
+ spec.add_runtime_dependency "alchemy_cms", [">= 8.2.0", "< 9"]
22
22
  spec.add_runtime_dependency "pg_search", ["~> 2.1"]
23
23
  spec.add_runtime_dependency "pg"
24
24
 
@@ -4,16 +4,20 @@ module Alchemy::Search::ElementExtension
4
4
  end
5
5
 
6
6
  def searchable
7
- definition.key?(:searchable) ? definition[:searchable] : true
7
+ definition.searchable
8
8
  end
9
9
 
10
10
  def searchable?
11
- searchable && public? && page.searchable? && page_version.public?
11
+ searchable && public? && page.searchable? && page_version.public? && parent_elements_searchable?
12
12
  end
13
13
 
14
14
  def searchable_content
15
15
  ingredients.select(&:searchable?).map(&:searchable_content).join(" ").squish
16
16
  end
17
+
18
+ def parent_elements_searchable?
19
+ parent_element.nil? || (parent_element.searchable && parent_element.public? && parent_element.parent_elements_searchable?)
20
+ end
17
21
  end
18
22
 
19
23
  Alchemy::Element.prepend(Alchemy::Search::ElementExtension)
@@ -5,7 +5,7 @@ module Alchemy::Search::IngredientExtension
5
5
 
6
6
  def searchable?
7
7
  Alchemy.searchable_ingredients.has_key?(type.to_sym) &&
8
- (definition.key?(:searchable) ? definition[:searchable] : true) &&
8
+ definition.searchable &&
9
9
  !!element&.searchable?
10
10
  end
11
11
  end
@@ -2,12 +2,11 @@
2
2
  #
3
3
  module Alchemy::Search::PageExtension
4
4
  def searchable?
5
- (definition.key?(:searchable) ? definition[:searchable] : true) &&
6
- searchable && public? && !layoutpage?
5
+ definition.searchable && searchable && public? && !layoutpage?
7
6
  end
8
7
 
9
8
  def searchable_content
10
- all_elements.includes(ingredients: {element: :page}).map(&:searchable_content).join(" ")
9
+ all_elements.includes(:page, :page_version, {parent_element: :parent_element}, ingredients: {element: :page}).map(&:searchable_content).join(" ")
11
10
  end
12
11
  end
13
12
 
@@ -21,17 +21,17 @@ module Alchemy
21
21
 
22
22
  def self.search_result_page
23
23
  @search_result_page ||= begin
24
- page_layouts = PageLayout.all.select do |page_layout|
25
- page_layout.key?(:searchresults) && page_layout[:searchresults].to_s.casecmp(true.to_s).zero?
24
+ page_definitions = ::Alchemy::PageDefinition.all.select do |page_definition|
25
+ page_definition.searchresults
26
26
  end
27
27
 
28
- if page_layouts.nil?
28
+ if page_definitions.nil?
29
29
  raise "No searchresults page layout found. Please add page layout with `searchresults: true` into your `page_layouts.yml` file."
30
30
  end
31
31
 
32
32
  page = Page.published.find_by(
33
- page_layout: page_layouts.first["name"],
34
- language_id: Language.current.id,
33
+ page_layout: page_definitions.first.name,
34
+ language_id: ::Alchemy::Current.language.id,
35
35
  )
36
36
  if page.nil?
37
37
  logger.warn "\n++++++\nNo published search result page found. Please create one or publish your search result page.\n++++++\n"
data/bin/setup ADDED
@@ -0,0 +1,42 @@
1
+ #!/usr/bin/env ruby
2
+ require "fileutils"
3
+
4
+ # path to dummy application root.
5
+ APP_ROOT = File.expand_path("../spec/dummy", __dir__)
6
+
7
+ # path to alchemy gem
8
+ GEM_ROOT = File.expand_path("../", __dir__)
9
+
10
+ def system!(*args)
11
+ system(*args) || abort("\n== Command #{args} failed ==")
12
+ end
13
+
14
+ FileUtils.chdir GEM_ROOT do
15
+ system! "gem install bundler --conservative"
16
+ system("bundle check") || system!("bundle install")
17
+ end
18
+
19
+ FileUtils.chdir APP_ROOT do
20
+ puts "\n== Remove migration files for dummy app =="
21
+ Dir.glob("db/migrate/*.rb")
22
+ .reject { |f| f.include?("create_users") || f.include?("pg_search_documents") }
23
+ .each { |f| FileUtils.rm(f) }
24
+
25
+ puts "\n== Create database for dummy app =="
26
+ system!("bin/rails db:drop")
27
+ system!("bin/rails db:create")
28
+
29
+ puts "\n== Installing Alchemy CMS into dummy app =="
30
+ system!("bin/rails g alchemy:install --skip --skip-demo-files --auto-accept")
31
+
32
+ puts "\n== Installing Alchemy PGSearch into dummy app =="
33
+ system!("bin/rails g alchemy:pg_search:install")
34
+
35
+ puts "\n== Removing old logs and tempfiles =="
36
+ system! "bin/rails log:clear tmp:clear"
37
+
38
+ puts "\n== Removing old logs and tempfiles =="
39
+ system! "RAILS_ENV=test bin/rails db:schema:load"
40
+ end
41
+
42
+ puts "\n== Alchemy PgSearch is ready 🎉 =="
@@ -12,12 +12,12 @@ module Alchemy
12
12
  end
13
13
 
14
14
  # In development environment, this runs on every code reload, so avoid multiple reindexing jobs
15
- unless Alchemy.publish_targets.map(&:name).include? 'Alchemy::PgSearch::IndexPageJob'
15
+ unless Alchemy.config.publish_targets.map(&:name).include? 'Alchemy::PgSearch::IndexPageJob'
16
16
  # reindex the page after it was published
17
- Alchemy.publish_targets << Alchemy::PgSearch::IndexPageJob
17
+ Alchemy.config.publish_targets << "Alchemy::PgSearch::IndexPageJob"
18
18
  end
19
19
  # enable searchable flag in page form
20
- Alchemy.enable_searchable = true
20
+ Alchemy.config.show_page_searchable_checkbox = true
21
21
 
22
22
  # configure multiselect to find also partial words
23
23
  # @link https://github.com/Casecommons/pg_search#searching-using-different-search-features
@@ -1,5 +1,5 @@
1
1
  module Alchemy
2
2
  module PgSearch
3
- VERSION = "7.4.0"
3
+ VERSION = "8.2.0"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: alchemy-pg_search
3
3
  version: !ruby/object:Gem::Version
4
- version: 7.4.0
4
+ version: 8.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Thomas von Deyen
@@ -15,20 +15,20 @@ dependencies:
15
15
  requirements:
16
16
  - - ">="
17
17
  - !ruby/object:Gem::Version
18
- version: '7.4'
18
+ version: 8.2.0
19
19
  - - "<"
20
20
  - !ruby/object:Gem::Version
21
- version: '8'
21
+ version: '9'
22
22
  type: :runtime
23
23
  prerelease: false
24
24
  version_requirements: !ruby/object:Gem::Requirement
25
25
  requirements:
26
26
  - - ">="
27
27
  - !ruby/object:Gem::Version
28
- version: '7.4'
28
+ version: 8.2.0
29
29
  - - "<"
30
30
  - !ruby/object:Gem::Version
31
- version: '8'
31
+ version: '9'
32
32
  - !ruby/object:Gem::Dependency
33
33
  name: pg_search
34
34
  requirement: !ruby/object:Gem::Requirement
@@ -106,6 +106,8 @@ executables: []
106
106
  extensions: []
107
107
  extra_rdoc_files: []
108
108
  files:
109
+ - ".backportrc.json"
110
+ - ".github/workflows/backport.yml"
109
111
  - ".github/workflows/ci.yml"
110
112
  - ".github/workflows/post-release.yml"
111
113
  - ".github/workflows/prepare-release.yml"
@@ -130,6 +132,7 @@ files:
130
132
  - app/views/alchemy/search/_results.html.erb
131
133
  - bin/rails
132
134
  - bin/rspec
135
+ - bin/setup
133
136
  - config/locales/alchemy.search.de.yml
134
137
  - config/locales/alchemy.search.en.yml
135
138
  - db/migrate/20220826125413_add_page_id_column_to_pg_search_documents.rb
@@ -161,7 +164,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
161
164
  version: '0'
162
165
  requirements:
163
166
  - PostgreSQL >= 12.x
164
- rubygems_version: 4.0.6
167
+ rubygems_version: 4.0.10
165
168
  specification_version: 4
166
169
  summary: This gem provides PostgreSQL full text search to Alchemy
167
170
  test_files: []