alchemy-pg_search 2.0.0 → 2.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +13 -0
- data/Gemfile +7 -4
- data/alchemy-pg_search.gemspec +1 -1
- data/db/migrate/20141211105526_add_searchable_to_alchemy_essence_texts.rb +1 -1
- data/db/migrate/20141211105942_add_searchable_to_alchemy_essence_richtexts.rb +1 -1
- data/db/migrate/20141211110126_add_searchable_to_alchemy_essence_pictures.rb +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 +7 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b9b68ff72c39fd21b51251b0d47919016fd3d59a8e32a0358ce4c4b48170cd4d
|
4
|
+
data.tar.gz: afb71a844327fe5f9a07a2a8b91edbab57da267e514e9d3fc51a32d2369c3465
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 60d7d211907766eee70dd946ac8c5dca0bc535a562feda995d441e0872e3a418337ec0060502aa32b45fbf432709e6380541b233fda1f152c3f56444a2bff6b7
|
7
|
+
data.tar.gz: e90ff5b03757e72b6ef471470ee972dc615fa54cac75803c9c6000284e19cb20ac557a1b3b2453aea0e8eaa985254086d4ad1698e10f9fe27ccb2140bf2cdce6
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,16 @@
|
|
1
|
+
## 2.3.0 (2022-03-04)
|
2
|
+
|
3
|
+
- Add support for Alchemy 5.1 [#24](https://github.com/AlchemyCMS/alchemy-pg_search/pull/24) by [kulturbande](https://github.com/kulturbande)
|
4
|
+
|
5
|
+
## 2.2.0 (2021-09-25)
|
6
|
+
|
7
|
+
- Alchemy 4.3 [#21](https://github.com/AlchemyCMS/alchemy-pg_search/pull/21) by [tvdeyen](https://github.com/tvdeyen)
|
8
|
+
|
9
|
+
## 2.1.0 (2021-09-25)
|
10
|
+
|
11
|
+
- Do not allow Alchemy 4.3 and above [#22](https://github.com/AlchemyCMS/alchemy-pg_search/pull/22) by [tvdeyen](https://github.com/tvdeyen)
|
12
|
+
- Add Rails 5.1 support [#19](https://github.com/AlchemyCMS/alchemy-pg_search/pull/19) by [tvdeyen](https://github.com/tvdeyen)
|
13
|
+
|
1
14
|
## 2.0.0 (2021-09-23)
|
2
15
|
|
3
16
|
- Move searchable attribute to contents table [#20](https://github.com/AlchemyCMS/alchemy-pg_search/pull/20) 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.1-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/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", "< 5.2"]
|
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.3.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-03-04 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: '5.
|
22
|
+
version: '5.2'
|
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: '5.
|
32
|
+
version: '5.2'
|
33
33
|
- !ruby/object:Gem::Dependency
|
34
34
|
name: pg_search
|
35
35
|
requirement: !ruby/object:Gem::Requirement
|
@@ -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
|