c2cgeoportal-geoportal 2.9.0.142__py3-none-any.whl → 2.9.0.146__py3-none-any.whl
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.
- c2cgeoportal_geoportal/scripts/theme2fts.py +68 -19
- {c2cgeoportal_geoportal-2.9.0.142.dist-info → c2cgeoportal_geoportal-2.9.0.146.dist-info}/METADATA +1 -1
- {c2cgeoportal_geoportal-2.9.0.142.dist-info → c2cgeoportal_geoportal-2.9.0.146.dist-info}/RECORD +6 -6
- {c2cgeoportal_geoportal-2.9.0.142.dist-info → c2cgeoportal_geoportal-2.9.0.146.dist-info}/WHEEL +0 -0
- {c2cgeoportal_geoportal-2.9.0.142.dist-info → c2cgeoportal_geoportal-2.9.0.146.dist-info}/entry_points.txt +0 -0
- {c2cgeoportal_geoportal-2.9.0.142.dist-info → c2cgeoportal_geoportal-2.9.0.146.dist-info}/top_level.txt +0 -0
@@ -34,8 +34,8 @@ from collections.abc import Iterator
|
|
34
34
|
from typing import TYPE_CHECKING, Any, Optional
|
35
35
|
|
36
36
|
import pyramid.config
|
37
|
+
import sqlalchemy.orm
|
37
38
|
import transaction
|
38
|
-
from sqlalchemy import func
|
39
39
|
from sqlalchemy.orm.session import Session
|
40
40
|
|
41
41
|
from c2cgeoportal_geoportal.lib.bashcolor import Color, colorize
|
@@ -134,6 +134,9 @@ class Import:
|
|
134
134
|
from c2cgeoportal_commons.models.main import ( # pylint: disable=import-outside-toplevel
|
135
135
|
FullTextSearch,
|
136
136
|
Interface,
|
137
|
+
LayerGroup,
|
138
|
+
LayerWMS,
|
139
|
+
LayerWMTS,
|
137
140
|
Role,
|
138
141
|
Theme,
|
139
142
|
)
|
@@ -160,19 +163,64 @@ class Import:
|
|
160
163
|
query = query.filter(Interface.name.notin_(options.exclude_interfaces))
|
161
164
|
self.interfaces = query.all()
|
162
165
|
|
166
|
+
print("Create cache")
|
167
|
+
self._layerswms_cache = (
|
168
|
+
self.session.query(LayerWMS).options(sqlalchemy.orm.subqueryload(LayerWMS.metadatas)).all()
|
169
|
+
)
|
170
|
+
self._layerswmts_cache = (
|
171
|
+
self.session.query(LayerWMTS).options(sqlalchemy.orm.subqueryload(LayerWMTS.metadatas)).all()
|
172
|
+
)
|
173
|
+
self._layergroup_cache = (
|
174
|
+
self.session.query(LayerGroup)
|
175
|
+
.options(
|
176
|
+
sqlalchemy.orm.subqueryload(LayerGroup.children_relation),
|
177
|
+
sqlalchemy.orm.subqueryload(LayerWMS.metadatas),
|
178
|
+
)
|
179
|
+
.all()
|
180
|
+
)
|
181
|
+
all_themes = (
|
182
|
+
self.session.query(Theme)
|
183
|
+
.options(
|
184
|
+
sqlalchemy.orm.subqueryload(Theme.children_relation),
|
185
|
+
sqlalchemy.orm.subqueryload(LayerWMS.metadatas),
|
186
|
+
)
|
187
|
+
.all()
|
188
|
+
)
|
189
|
+
|
190
|
+
print("Collecting data")
|
191
|
+
|
163
192
|
self.public_theme: dict[int, list[int]] = {}
|
164
193
|
self.public_group: dict[int, list[int]] = {}
|
165
194
|
for interface in self.interfaces:
|
166
195
|
self.public_theme[interface.id] = []
|
167
196
|
self.public_group[interface.id] = []
|
168
197
|
|
198
|
+
self.full_text_search: list[dict[str, Any]] = []
|
199
|
+
|
169
200
|
for theme in self.session.query(Theme).filter_by(public=True).all():
|
170
201
|
self._add_theme(theme)
|
171
202
|
|
172
203
|
for role in self.session.query(Role).all():
|
173
|
-
for theme in
|
204
|
+
for theme in all_themes:
|
174
205
|
self._add_theme(theme, role)
|
175
206
|
|
207
|
+
print(f"Starting to fill the full-text search table with {len(self.full_text_search)} entries")
|
208
|
+
self.session.execute(
|
209
|
+
sqlalchemy.insert(FullTextSearch).values(
|
210
|
+
{
|
211
|
+
"label": sqlalchemy.text(":label"),
|
212
|
+
"role_id": sqlalchemy.text(":role_id"),
|
213
|
+
"interface_id": sqlalchemy.text(":interface_id"),
|
214
|
+
"lang": sqlalchemy.text(":lang"),
|
215
|
+
"public": sqlalchemy.text(":public"),
|
216
|
+
"ts": sqlalchemy.text("to_tsvector(:fts_lang, :fts_content)"),
|
217
|
+
"actions": sqlalchemy.text("to_json(:actions)"),
|
218
|
+
"from_theme": sqlalchemy.text(":from_theme"),
|
219
|
+
}
|
220
|
+
),
|
221
|
+
self.full_text_search,
|
222
|
+
)
|
223
|
+
|
176
224
|
def _add_fts(
|
177
225
|
self,
|
178
226
|
item: "c2cgeoportal_commons.models.main.TreeItem",
|
@@ -180,8 +228,6 @@ class Import:
|
|
180
228
|
action: str,
|
181
229
|
role: Optional["c2cgeoportal_commons.models.main.Role"],
|
182
230
|
) -> None:
|
183
|
-
from c2cgeoportal_commons.models.main import FullTextSearch # pylint: disable=import-outside-toplevel
|
184
|
-
|
185
231
|
key = (
|
186
232
|
item.name if self.options.name else item.id,
|
187
233
|
interface.id,
|
@@ -190,22 +236,25 @@ class Import:
|
|
190
236
|
if key not in self.imported:
|
191
237
|
self.imported.add(key)
|
192
238
|
for lang in self.languages:
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
239
|
+
content = " ".join(
|
240
|
+
[
|
241
|
+
self.fts_normalizer(self._[lang].gettext(item.name)),
|
242
|
+
*[v.strip() for m in item.get_metadata("searchAlias") for v in m.value.split(",")],
|
243
|
+
]
|
244
|
+
)
|
245
|
+
self.full_text_search.append(
|
246
|
+
{
|
247
|
+
"label": self._render_label(item, lang),
|
248
|
+
"role_id": role.id if role is not None else None,
|
249
|
+
"interface_id": interface.id,
|
250
|
+
"lang": lang,
|
251
|
+
"public": role is None,
|
252
|
+
"fts_lang": self.fts_languages[lang],
|
253
|
+
"fts_content": content,
|
254
|
+
"actions": [{"action": action, "data": item.name}],
|
255
|
+
"from_theme": True,
|
256
|
+
}
|
205
257
|
)
|
206
|
-
fts.actions = [{"action": action, "data": item.name}]
|
207
|
-
fts.from_theme = True
|
208
|
-
self.session.add(fts)
|
209
258
|
|
210
259
|
def _add_theme(
|
211
260
|
self,
|
{c2cgeoportal_geoportal-2.9.0.142.dist-info → c2cgeoportal_geoportal-2.9.0.146.dist-info}/RECORD
RENAMED
@@ -147,7 +147,7 @@ c2cgeoportal_geoportal/scripts/c2cupgrade.py,sha256=oWgl5ngJaUVXDKJqJ33aZB8ET_Xc
|
|
147
147
|
c2cgeoportal_geoportal/scripts/create_demo_theme.py,sha256=-SL-fvAPjgiJZEKYcbhXsZm713txhtWQB18X231k6xQ,3263
|
148
148
|
c2cgeoportal_geoportal/scripts/manage_users.py,sha256=Ih3X_V_xUw59Ums4a1x6qQQtz9VtE7PaxAj-tiZIOPg,5586
|
149
149
|
c2cgeoportal_geoportal/scripts/pcreate.py,sha256=xU87K_JYwFE6U4zEGjHvqNj2iiSuAhPkfWMpI576mZ8,11245
|
150
|
-
c2cgeoportal_geoportal/scripts/theme2fts.py,sha256=
|
150
|
+
c2cgeoportal_geoportal/scripts/theme2fts.py,sha256=6JqfRO5mjuimMOMjdMCpK9whSaR4DT8UdEJEp7ob2zE,15584
|
151
151
|
c2cgeoportal_geoportal/scripts/urllogin.py,sha256=qGOOvx2ZN3qnENGzo8NScRqfFC06l1yc48vU6Qx3MBo,3319
|
152
152
|
c2cgeoportal_geoportal/templates/login.html,sha256=Jy8CUw2KrSviePknsvWJLDqCUXam-vPhnMUv7UcD4Pc,2475
|
153
153
|
c2cgeoportal_geoportal/templates/notlogin.html,sha256=XLCwJ8q7hqk6GIaxwhyMOaMZZZvsD_MMZaCERO8n2AY,1528
|
@@ -187,8 +187,8 @@ tests/test_mapserverproxy_route_predicate.py,sha256=SzILSSzIuilzIkUYVPZiVzLwW1du
|
|
187
187
|
tests/test_raster.py,sha256=82NJ2MXgZlMqs0ytN-VgNw376iURdk4PkAg__dyh5ns,11948
|
188
188
|
tests/test_wmstparsing.py,sha256=xjA8nJuXFl3H5Bfs4sJw_8qX8E8qvAALK7Hs2-DTP2A,9054
|
189
189
|
tests/xmlstr.py,sha256=rkTKSU4FGjupBKLx75H8o-goB0KbQrxDvdpc6xVX_uQ,5985
|
190
|
-
c2cgeoportal_geoportal-2.9.0.
|
191
|
-
c2cgeoportal_geoportal-2.9.0.
|
192
|
-
c2cgeoportal_geoportal-2.9.0.
|
193
|
-
c2cgeoportal_geoportal-2.9.0.
|
194
|
-
c2cgeoportal_geoportal-2.9.0.
|
190
|
+
c2cgeoportal_geoportal-2.9.0.146.dist-info/METADATA,sha256=6UbiWLudX0HQNGRPziZAvMlPtF8b_eolRjJ1zTwdOJI,1923
|
191
|
+
c2cgeoportal_geoportal-2.9.0.146.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
|
192
|
+
c2cgeoportal_geoportal-2.9.0.146.dist-info/entry_points.txt,sha256=3dnX260FsLX_AubeNMdyeta_z1X4CxcD3steAlfPx2I,1414
|
193
|
+
c2cgeoportal_geoportal-2.9.0.146.dist-info/top_level.txt,sha256=PJIbY7Nx51dDrJ052f5mDA7c6Tehm5aD-Gb32L_CtJA,29
|
194
|
+
c2cgeoportal_geoportal-2.9.0.146.dist-info/RECORD,,
|
{c2cgeoportal_geoportal-2.9.0.142.dist-info → c2cgeoportal_geoportal-2.9.0.146.dist-info}/WHEEL
RENAMED
File without changes
|
File without changes
|
File without changes
|