alchemy-pg_search 2.1.0 → 2.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 +4 -4
- data/.github/workflows/ci.yml +29 -0
- data/CHANGELOG.md +12 -0
- data/Gemfile +7 -4
- data/README.md +1 -1
- data/alchemy-pg_search.gemspec +1 -1
- data/lib/alchemy/pg_search/content_extension.rb +3 -2
- data/lib/alchemy/pg_search/page_extension.rb +48 -52
- data/lib/alchemy/pg_search/version.rb +1 -1
- metadata +8 -8
- data/.travis.yml +0 -13
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9549e748d89548023d9df7829e219fa3b6a407d3b5ad002029b4ec36b26301a1
|
4
|
+
data.tar.gz: 615172e174163bd0edc420040750e849d9b8655277c9b7d6418187e5442fde22
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dbbb491dc844fedaf74efbebfa67f4ae03d6288e18b70dae0d6cdac0e2a5664bc756fcd1f47ed236c3abc959703ee183f8b643f0d4698f7c1a3e1430cd216628
|
7
|
+
data.tar.gz: c3870c31a905d108a9f4faf39335ab9ad59bd5246962671c570c93ab8d4d1ea50da35c6bc12491db76b021cc403e5ec11938716c41d61b9de26647850a36f665
|
@@ -0,0 +1,29 @@
|
|
1
|
+
name: CI
|
2
|
+
|
3
|
+
on: [push, pull_request]
|
4
|
+
|
5
|
+
jobs:
|
6
|
+
RSpec:
|
7
|
+
runs-on: ubuntu-latest
|
8
|
+
env:
|
9
|
+
RAILS_ENV: test
|
10
|
+
services:
|
11
|
+
postgres:
|
12
|
+
image: postgres:11
|
13
|
+
env:
|
14
|
+
POSTGRES_USER: postgres
|
15
|
+
POSTGRES_PASSWORD: password
|
16
|
+
POSTGRES_DB: alchemy_pg_search_test
|
17
|
+
ports: ["5432:5432"]
|
18
|
+
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
|
19
|
+
steps:
|
20
|
+
- uses: actions/checkout@v2.3.4
|
21
|
+
- name: Set up Ruby
|
22
|
+
uses: ruby/setup-ruby@v1
|
23
|
+
with:
|
24
|
+
ruby-version: 2.7
|
25
|
+
bundler-cache: true
|
26
|
+
- name: Prepare database
|
27
|
+
run: bundle exec rake alchemy:spec:prepare
|
28
|
+
- name: Run tests
|
29
|
+
run: bundle exec rspec
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,15 @@
|
|
1
|
+
## 2.4.0 (2022-06-06)
|
2
|
+
|
3
|
+
- Add support for Alchemy 5.2 [#25](https://github.com/AlchemyCMS/alchemy-pg_search/pull/25) by [kulturbande](https://github.com/kulturbande)
|
4
|
+
|
5
|
+
## 2.3.0 (2022-03-04)
|
6
|
+
|
7
|
+
- Add support for Alchemy 5.1 [#24](https://github.com/AlchemyCMS/alchemy-pg_search/pull/24) by [kulturbande](https://github.com/kulturbande)
|
8
|
+
|
9
|
+
## 2.2.0 (2021-09-25)
|
10
|
+
|
11
|
+
- Alchemy 4.3 [#21](https://github.com/AlchemyCMS/alchemy-pg_search/pull/21) by [tvdeyen](https://github.com/tvdeyen)
|
12
|
+
|
1
13
|
## 2.1.0 (2021-09-25)
|
2
14
|
|
3
15
|
- Do not allow Alchemy 4.3 and above [#22](https://github.com/AlchemyCMS/alchemy-pg_search/pull/22) by [tvdeyen](https://github.com/tvdeyen)
|
data/Gemfile
CHANGED
@@ -2,11 +2,14 @@ source "https://rubygems.org"
|
|
2
2
|
|
3
3
|
gemspec
|
4
4
|
|
5
|
-
gem "rails", "~>
|
6
|
-
|
5
|
+
gem "rails", "~> 6.0.0"
|
6
|
+
ENV.fetch("ALCHEMY_BRANCH", "5.3-stable").tap do |branch|
|
7
|
+
gem "alchemy_cms", github: "AlchemyCMS/alchemy_cms", branch: branch
|
8
|
+
end
|
7
9
|
gem "sassc-rails"
|
8
|
-
gem "sassc", "
|
9
|
-
gem "
|
10
|
+
gem "sassc", "~> 2.4.0"
|
11
|
+
gem "webpacker"
|
12
|
+
gem "pg", "~> 1.0"
|
10
13
|
gem "puma"
|
11
14
|
|
12
15
|
group :test do
|
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
[](https://github.com/AlchemyCMS/alchemy-pg_search/actions/workflows/ci.yml)
|
2
2
|
|
3
3
|
# Alchemy CMS Postgresql Fulltext Search
|
4
4
|
|
data/alchemy-pg_search.gemspec
CHANGED
@@ -16,7 +16,7 @@ Gem::Specification.new do |spec|
|
|
16
16
|
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^spec/}) }
|
17
17
|
spec.require_paths = ["lib"]
|
18
18
|
|
19
|
-
spec.add_runtime_dependency "alchemy_cms", [">= 4.
|
19
|
+
spec.add_runtime_dependency "alchemy_cms", [">= 4.3", "< 6"]
|
20
20
|
spec.add_runtime_dependency "pg_search", ["~> 2.1"]
|
21
21
|
spec.add_runtime_dependency "pg"
|
22
22
|
|
@@ -1,7 +1,8 @@
|
|
1
1
|
module Alchemy::PgSearch::ContentExtension
|
2
2
|
module ClassMethods
|
3
|
-
def
|
4
|
-
|
3
|
+
def new(attributes)
|
4
|
+
element = attributes[:element]
|
5
|
+
definition = element.content_definition_for(attributes[:name])
|
5
6
|
super.tap do |content|
|
6
7
|
content.searchable = definition.key?(:searchable) ? definition[:searchable] : true
|
7
8
|
end
|
@@ -1,58 +1,54 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
# Enable Postgresql full text indexing.
|
2
|
+
#
|
3
|
+
module Alchemy::PgSearch::PageExtension
|
4
|
+
def self.extended(base)
|
5
|
+
base.include InstanceMethods
|
6
|
+
base.include PgSearch::Model
|
3
7
|
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
8
|
+
base.pg_search_scope(
|
9
|
+
:full_text_search,
|
10
|
+
against: {
|
11
|
+
meta_description: "B",
|
12
|
+
meta_keywords: "B",
|
13
|
+
title: "B",
|
14
|
+
name: "A",
|
15
|
+
},
|
16
|
+
associated_against: {
|
17
|
+
searchable_essence_texts: :body,
|
18
|
+
searchable_essence_richtexts: :stripped_body,
|
19
|
+
searchable_essence_pictures: :caption,
|
20
|
+
},
|
21
|
+
using: {
|
22
|
+
tsearch: { prefix: true },
|
23
|
+
},
|
24
|
+
)
|
21
25
|
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
source: :essence
|
26
|
+
base.has_many(
|
27
|
+
:searchable_contents,
|
28
|
+
-> {
|
29
|
+
where(alchemy_elements: { public: true })
|
30
|
+
.where(searchable: true)
|
31
|
+
},
|
32
|
+
class_name: "Alchemy::Content",
|
33
|
+
through: :all_elements,
|
34
|
+
)
|
32
35
|
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
has_many :searchable_essence_pictures,
|
45
|
-
-> {
|
46
|
-
includes(:element)
|
47
|
-
.where(alchemy_contents: { searchable: true })
|
48
|
-
.where(alchemy_elements: { public: true })
|
49
|
-
},
|
50
|
-
class_name: "Alchemy::EssencePicture",
|
51
|
-
source_type: "Alchemy::EssencePicture",
|
52
|
-
through: :descendent_contents,
|
53
|
-
source: :essence
|
36
|
+
Alchemy::PgSearch::SEARCHABLE_ESSENCES.each do |klass|
|
37
|
+
base.has_many(
|
38
|
+
:"searchable_#{klass.underscore.pluralize}",
|
39
|
+
class_name: "Alchemy::#{klass}",
|
40
|
+
source_type: "Alchemy::#{klass}",
|
41
|
+
through: :searchable_contents,
|
42
|
+
source: :essence,
|
43
|
+
)
|
44
|
+
end
|
45
|
+
end
|
54
46
|
|
55
|
-
|
56
|
-
|
47
|
+
module InstanceMethods
|
48
|
+
def element_search_results(query)
|
49
|
+
all_elements.full_text_search(query)
|
50
|
+
end
|
57
51
|
end
|
52
|
+
|
53
|
+
Alchemy::Page.extend self
|
58
54
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: alchemy-pg_search
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Thomas von Deyen
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-06-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: alchemy_cms
|
@@ -16,20 +16,20 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '4.
|
19
|
+
version: '4.3'
|
20
20
|
- - "<"
|
21
21
|
- !ruby/object:Gem::Version
|
22
|
-
version: '
|
22
|
+
version: '6'
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
25
|
version_requirements: !ruby/object:Gem::Requirement
|
26
26
|
requirements:
|
27
27
|
- - ">="
|
28
28
|
- !ruby/object:Gem::Version
|
29
|
-
version: '4.
|
29
|
+
version: '4.3'
|
30
30
|
- - "<"
|
31
31
|
- !ruby/object:Gem::Version
|
32
|
-
version: '
|
32
|
+
version: '6'
|
33
33
|
- !ruby/object:Gem::Dependency
|
34
34
|
name: pg_search
|
35
35
|
requirement: !ruby/object:Gem::Requirement
|
@@ -107,8 +107,8 @@ executables: []
|
|
107
107
|
extensions: []
|
108
108
|
extra_rdoc_files: []
|
109
109
|
files:
|
110
|
+
- ".github/workflows/ci.yml"
|
110
111
|
- ".gitignore"
|
111
|
-
- ".travis.yml"
|
112
112
|
- CHANGELOG.md
|
113
113
|
- Gemfile
|
114
114
|
- LICENSE
|
@@ -159,7 +159,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
159
159
|
- !ruby/object:Gem::Version
|
160
160
|
version: '0'
|
161
161
|
requirements: []
|
162
|
-
rubygems_version: 3.
|
162
|
+
rubygems_version: 3.1.6
|
163
163
|
signing_key:
|
164
164
|
specification_version: 4
|
165
165
|
summary: This gem provides PostgreSQL full text search to Alchemy 4.0
|