apidae 2.0.2 → 2.0.3
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b42cdaf85f8e59001ee19b5f22f15c5404d82af469803cd48136ba776632221e
|
4
|
+
data.tar.gz: 14b10d413128996dabd723ad2ac40309348b4451053395525493274cfea73921
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0b776494bee0b4e3011b6f8c2d1cb951e4a1dc2eb9bed58eb4e1e2962b24ac6d014236f15d13d20720ff428e6d34b61a5682c8cad4084a3b1420ddc68a1d8109
|
7
|
+
data.tar.gz: b1f38f9f5591857648e8c332a6e4e69638877a552ea135c8011063398f750f3ca702c16fce756f42700caaa3f9994648a9f61a4eef72b25c06e5df0fadf87870
|
data/app/models/apidae/obj.rb
CHANGED
@@ -3,7 +3,7 @@ require 'pg_search'
|
|
3
3
|
module Apidae
|
4
4
|
class Obj < ActiveRecord::Base
|
5
5
|
include PgSearch::Model
|
6
|
-
multisearchable against: [:
|
6
|
+
multisearchable against: [:w_title, :w_town, :w_short_desc, :w_criteria],
|
7
7
|
additional_attributes: -> (o) { { searchable_fields: o.searchable_fields } }
|
8
8
|
|
9
9
|
belongs_to :town, class_name: 'Apidae::Town', foreign_key: :town_insee_code, primary_key: :insee_code, optional: true
|
@@ -144,11 +144,19 @@ module Apidae
|
|
144
144
|
self
|
145
145
|
end
|
146
146
|
|
147
|
-
def
|
148
|
-
|
147
|
+
def w_title
|
148
|
+
title
|
149
149
|
end
|
150
150
|
|
151
|
-
def
|
151
|
+
def w_town
|
152
|
+
"#{town&.name}§§§"
|
153
|
+
end
|
154
|
+
|
155
|
+
def w_short_desc
|
156
|
+
"#{short_desc}§§§"
|
157
|
+
end
|
158
|
+
|
159
|
+
def w_criteria
|
152
160
|
([SUBTYPES.dig(apidae_subtype&.to_i, :label)] + ref_search(payment_methods, PAYMENT) +
|
153
161
|
ref_search(categories, CATEGORIES) + ref_search(themes, THEMES) + ref_search(labels, LABELS) +
|
154
162
|
ref_search(chains, CHAINS) + ref_search(classification, CLASSIFICATION) + ref_search(services, SERVICES) +
|
@@ -0,0 +1,23 @@
|
|
1
|
+
class AlterTsvColumnInPgSearchDocuments < ActiveRecord::Migration[7.2]
|
2
|
+
def up
|
3
|
+
execute <<-SQL
|
4
|
+
ALTER TABLE pg_search_documents DROP COLUMN IF EXISTS tsv_content;
|
5
|
+
ADD COLUMN tsv_content tsvector GENERATED ALWAYS AS (
|
6
|
+
setweight(to_tsvector('fr', coalesce(split_part(coalesce(content, ''), '§§§', 1), '')), 'A') ||
|
7
|
+
setweight(to_tsvector('fr', coalesce(split_part(coalesce(content, ''), '§§§', 2), '')), 'B') ||
|
8
|
+
setweight(to_tsvector('fr', coalesce(split_part(coalesce(content, ''), '§§§', 3), '')), 'C') ||
|
9
|
+
setweight(to_tsvector('fr', coalesce(split_part(coalesce(content, ''), '§§§', 4), '')), 'D') ||
|
10
|
+
) STORED;
|
11
|
+
SQL
|
12
|
+
end
|
13
|
+
|
14
|
+
def down
|
15
|
+
execute <<-SQL
|
16
|
+
ALTER TABLE pg_search_documents DROP COLUMN IF EXISTS tsv_content;
|
17
|
+
ALTER TABLE pg_search_documents
|
18
|
+
ADD COLUMN tsv_content tsvector GENERATED ALWAYS AS (
|
19
|
+
to_tsvector('fr', coalesce(content, ''))
|
20
|
+
) STORED;
|
21
|
+
SQL
|
22
|
+
end
|
23
|
+
end
|
data/lib/apidae/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: apidae
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jean-Baptiste Vilain
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-
|
11
|
+
date: 2025-03-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -212,6 +212,7 @@ files:
|
|
212
212
|
- db/migrate/20250130110941_add_columns_to_pg_search_documents.rb
|
213
213
|
- db/migrate/20250130120941_add_tsv_column_to_pg_search_documents.rb
|
214
214
|
- db/migrate/20250130152441_add_gin_index_to_pg_search_documents.rb
|
215
|
+
- db/migrate/20250318152322_alter_tsv_column_in_pg_search_documents.rb
|
215
216
|
- lib/apidae.rb
|
216
217
|
- lib/apidae/engine.rb
|
217
218
|
- lib/apidae/version.rb
|