ckanext-search-tweaks 0.6.2__tar.gz → 0.6.3__tar.gz
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.
- {ckanext_search_tweaks-0.6.2 → ckanext_search_tweaks-0.6.3}/MANIFEST.in +1 -1
- {ckanext_search_tweaks-0.6.2/ckanext_search_tweaks.egg-info → ckanext_search_tweaks-0.6.3}/PKG-INFO +1 -1
- ckanext_search_tweaks-0.6.3/ckanext/search_tweaks/config_declaration.yaml +24 -0
- {ckanext_search_tweaks-0.6.2 → ckanext_search_tweaks-0.6.3}/ckanext/search_tweaks/field_relevance/templates/search_tweaks/field_relevance/promote.html +1 -1
- {ckanext_search_tweaks-0.6.2 → ckanext_search_tweaks-0.6.3}/ckanext/search_tweaks/field_relevance/views.py +9 -1
- ckanext_search_tweaks-0.6.3/ckanext/search_tweaks/query_popularity/config_declaration.yaml +29 -0
- {ckanext_search_tweaks-0.6.2 → ckanext_search_tweaks-0.6.3}/ckanext/search_tweaks/query_relevance/cli.py +21 -1
- {ckanext_search_tweaks-0.6.2 → ckanext_search_tweaks-0.6.3}/ckanext/search_tweaks/query_relevance/plugin.py +2 -12
- {ckanext_search_tweaks-0.6.2 → ckanext_search_tweaks-0.6.3/ckanext_search_tweaks.egg-info}/PKG-INFO +1 -1
- {ckanext_search_tweaks-0.6.2 → ckanext_search_tweaks-0.6.3}/ckanext_search_tweaks.egg-info/SOURCES.txt +2 -0
- {ckanext_search_tweaks-0.6.2 → ckanext_search_tweaks-0.6.3}/pyproject.toml +1 -1
- {ckanext_search_tweaks-0.6.2 → ckanext_search_tweaks-0.6.3}/LICENSE +0 -0
- {ckanext_search_tweaks-0.6.2 → ckanext_search_tweaks-0.6.3}/README.md +0 -0
- {ckanext_search_tweaks-0.6.2 → ckanext_search_tweaks-0.6.3}/ckanext/__init__.py +0 -0
- {ckanext_search_tweaks-0.6.2 → ckanext_search_tweaks-0.6.3}/ckanext/search_tweaks/__init__.py +0 -0
- {ckanext_search_tweaks-0.6.2 → ckanext_search_tweaks-0.6.3}/ckanext/search_tweaks/advanced_search/__init__.py +0 -0
- {ckanext_search_tweaks-0.6.2 → ckanext_search_tweaks-0.6.3}/ckanext/search_tweaks/advanced_search/assets/advanced-search.css +0 -0
- {ckanext_search_tweaks-0.6.2 → ckanext_search_tweaks-0.6.3}/ckanext/search_tweaks/advanced_search/assets/advanced-search.js +0 -0
- {ckanext_search_tweaks-0.6.2 → ckanext_search_tweaks-0.6.3}/ckanext/search_tweaks/advanced_search/assets/webassets.yml +0 -0
- {ckanext_search_tweaks-0.6.2 → ckanext_search_tweaks-0.6.3}/ckanext/search_tweaks/advanced_search/plugin.py +0 -0
- {ckanext_search_tweaks-0.6.2 → ckanext_search_tweaks-0.6.3}/ckanext/search_tweaks/advanced_search/templates/advanced_search/search_form.html +0 -0
- {ckanext_search_tweaks-0.6.2 → ckanext_search_tweaks-0.6.3}/ckanext/search_tweaks/cli.py +0 -0
- {ckanext_search_tweaks-0.6.2 → ckanext_search_tweaks-0.6.3}/ckanext/search_tweaks/config.py +0 -0
- {ckanext_search_tweaks-0.6.2 → ckanext_search_tweaks-0.6.3}/ckanext/search_tweaks/field_relevance/__init__.py +0 -0
- {ckanext_search_tweaks-0.6.2 → ckanext_search_tweaks-0.6.3}/ckanext/search_tweaks/field_relevance/assets/search-tweaks-reflect-range-in-label.js +0 -0
- {ckanext_search_tweaks-0.6.2 → ckanext_search_tweaks-0.6.3}/ckanext/search_tweaks/field_relevance/assets/webassets.yml +0 -0
- {ckanext_search_tweaks-0.6.2 → ckanext_search_tweaks-0.6.3}/ckanext/search_tweaks/field_relevance/plugin.py +0 -0
- {ckanext_search_tweaks-0.6.2 → ckanext_search_tweaks-0.6.3}/ckanext/search_tweaks/interfaces.py +0 -0
- {ckanext_search_tweaks-0.6.2 → ckanext_search_tweaks-0.6.3}/ckanext/search_tweaks/plugin.py +0 -0
- {ckanext_search_tweaks-0.6.2 → ckanext_search_tweaks-0.6.3}/ckanext/search_tweaks/query_popularity/__init__.py +0 -0
- {ckanext_search_tweaks-0.6.2 → ckanext_search_tweaks-0.6.3}/ckanext/search_tweaks/query_popularity/config.py +0 -0
- {ckanext_search_tweaks-0.6.2 → ckanext_search_tweaks-0.6.3}/ckanext/search_tweaks/query_popularity/logic/__init__.py +0 -0
- {ckanext_search_tweaks-0.6.2 → ckanext_search_tweaks-0.6.3}/ckanext/search_tweaks/query_popularity/logic/action.py +0 -0
- {ckanext_search_tweaks-0.6.2 → ckanext_search_tweaks-0.6.3}/ckanext/search_tweaks/query_popularity/logic/auth.py +0 -0
- {ckanext_search_tweaks-0.6.2 → ckanext_search_tweaks-0.6.3}/ckanext/search_tweaks/query_popularity/logic/schema.py +0 -0
- {ckanext_search_tweaks-0.6.2 → ckanext_search_tweaks-0.6.3}/ckanext/search_tweaks/query_popularity/plugin.py +0 -0
- {ckanext_search_tweaks-0.6.2 → ckanext_search_tweaks-0.6.3}/ckanext/search_tweaks/query_popularity/score.py +0 -0
- {ckanext_search_tweaks-0.6.2 → ckanext_search_tweaks-0.6.3}/ckanext/search_tweaks/query_relevance/__init__.py +0 -0
- {ckanext_search_tweaks-0.6.2 → ckanext_search_tweaks-0.6.3}/ckanext/search_tweaks/query_relevance/score.py +0 -0
- {ckanext_search_tweaks-0.6.2 → ckanext_search_tweaks-0.6.3}/ckanext/search_tweaks/query_relevance/storage.py +0 -0
- {ckanext_search_tweaks-0.6.2 → ckanext_search_tweaks-0.6.3}/ckanext/search_tweaks/shared.py +0 -0
- {ckanext_search_tweaks-0.6.2 → ckanext_search_tweaks-0.6.3}/ckanext/search_tweaks/spellcheck/__init__.py +0 -0
- {ckanext_search_tweaks-0.6.2 → ckanext_search_tweaks-0.6.3}/ckanext/search_tweaks/spellcheck/cli.py +0 -0
- {ckanext_search_tweaks-0.6.2 → ckanext_search_tweaks-0.6.3}/ckanext/search_tweaks/spellcheck/helpers.py +0 -0
- {ckanext_search_tweaks-0.6.2 → ckanext_search_tweaks-0.6.3}/ckanext/search_tweaks/spellcheck/plugin.py +0 -0
- {ckanext_search_tweaks-0.6.2 → ckanext_search_tweaks-0.6.3}/ckanext/search_tweaks/spellcheck/templates/search_tweaks/did_you_mean.html +0 -0
- {ckanext_search_tweaks-0.6.2 → ckanext_search_tweaks-0.6.3}/ckanext/search_tweaks/tests/__init__.py +0 -0
- {ckanext_search_tweaks-0.6.2 → ckanext_search_tweaks-0.6.3}/ckanext/search_tweaks/tests/conftest.py +0 -0
- {ckanext_search_tweaks-0.6.2 → ckanext_search_tweaks-0.6.3}/ckanext/search_tweaks/tests/query_relevance/__init__.py +0 -0
- {ckanext_search_tweaks-0.6.2 → ckanext_search_tweaks-0.6.3}/ckanext/search_tweaks/tests/query_relevance/test_plugin.py +0 -0
- {ckanext_search_tweaks-0.6.2 → ckanext_search_tweaks-0.6.3}/ckanext/search_tweaks/tests/query_relevance/test_score.py +0 -0
- {ckanext_search_tweaks-0.6.2 → ckanext_search_tweaks-0.6.3}/ckanext/search_tweaks/tests/query_relevance/test_storage.py +0 -0
- {ckanext_search_tweaks-0.6.2 → ckanext_search_tweaks-0.6.3}/ckanext/search_tweaks/tests/spellcheck/__init__.py +0 -0
- {ckanext_search_tweaks-0.6.2 → ckanext_search_tweaks-0.6.3}/ckanext/search_tweaks/tests/spellcheck/test_plugin.py +0 -0
- {ckanext_search_tweaks-0.6.2 → ckanext_search_tweaks-0.6.3}/ckanext/search_tweaks/tests/test_plugin.py +0 -0
- {ckanext_search_tweaks-0.6.2 → ckanext_search_tweaks-0.6.3}/ckanext_search_tweaks.egg-info/dependency_links.txt +0 -0
- {ckanext_search_tweaks-0.6.2 → ckanext_search_tweaks-0.6.3}/ckanext_search_tweaks.egg-info/entry_points.txt +0 -0
- {ckanext_search_tweaks-0.6.2 → ckanext_search_tweaks-0.6.3}/ckanext_search_tweaks.egg-info/requires.txt +0 -0
- {ckanext_search_tweaks-0.6.2 → ckanext_search_tweaks-0.6.3}/ckanext_search_tweaks.egg-info/top_level.txt +0 -0
- {ckanext_search_tweaks-0.6.2 → ckanext_search_tweaks-0.6.3}/requirements.txt +0 -0
- {ckanext_search_tweaks-0.6.2 → ckanext_search_tweaks-0.6.3}/setup.cfg +0 -0
- {ckanext_search_tweaks-0.6.2 → ckanext_search_tweaks-0.6.3}/setup.py +0 -0
@@ -1,5 +1,5 @@
|
|
1
1
|
include README.rst
|
2
2
|
include LICENSE
|
3
3
|
include requirements.txt
|
4
|
-
recursive-include ckanext/search_tweaks *.html *.json *.js *.less *.css *.mo *.yml
|
4
|
+
recursive-include ckanext/search_tweaks *.html *.json *.js *.less *.css *.mo *.yml *.yaml
|
5
5
|
recursive-include ckanext/search_tweaks/migration *.ini *.py *.mako
|
{ckanext_search_tweaks-0.6.2/ckanext_search_tweaks.egg-info → ckanext_search_tweaks-0.6.3}/PKG-INFO
RENAMED
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: ckanext-search-tweaks
|
3
|
-
Version: 0.6.
|
3
|
+
Version: 0.6.3
|
4
4
|
Author-email: DataShades <datashades@linkdigital.com.au>, Sergey Motornyuk <sergey.motornyuk@linkdigital.com.au>
|
5
5
|
Maintainer-email: DataShades <datashades@linkdigital.com.au>
|
6
6
|
License: AGPL
|
@@ -0,0 +1,24 @@
|
|
1
|
+
version: 1
|
2
|
+
groups:
|
3
|
+
- annotation: "ckanext-search-tweaks: common"
|
4
|
+
options:
|
5
|
+
- key: ckanext.search_tweaks.common.qf
|
6
|
+
placeholder: "name^4 title^4 tags^2 groups^2 text"
|
7
|
+
|
8
|
+
- key: ckanext.search_tweaks.common.mm
|
9
|
+
default: "1"
|
10
|
+
|
11
|
+
- key: ckanext.search_tweaks.common.fuzzy_search.enabled
|
12
|
+
type: bool
|
13
|
+
|
14
|
+
- key: ckanext.search_tweaks.common.fuzzy_search.distance
|
15
|
+
type: int
|
16
|
+
default: 1
|
17
|
+
|
18
|
+
- key: ckanext.search_tweaks.common.fuzzy_search.keep_original
|
19
|
+
type: bool
|
20
|
+
default: true
|
21
|
+
|
22
|
+
- key: ckanext.search_tweaks.common.prefer_boost
|
23
|
+
type: bool
|
24
|
+
default: true
|
@@ -17,7 +17,7 @@
|
|
17
17
|
<form id="dataset-edit" class="dataset-form" method="post" action="{{ action }}" data-module="basic-form" novalidate>
|
18
18
|
|
19
19
|
{% call form.input_block(field_name, _("Promotion level"), errors[field_name], classes=["search-tweaks-label-with-value"]) %}
|
20
|
-
<input data-module="search-tweaks-reflect-range-in-label" data-module-format=" (%d)" id="{{ field_name }}" type="range" name="{{ field_name }}" value="{{ data[field_name] }}" max="{{ max_promotion }}" />
|
20
|
+
<input data-module="search-tweaks-reflect-range-in-label" data-module-format=" (%d)" id="{{ field_name }}" type="range" name="{{ field_name }}" value="{{ data[field_name] }}" min="{{ min_promotion }}" max="{{ max_promotion }}" />
|
21
21
|
{% endcall %}
|
22
22
|
|
23
23
|
{% block form_actions %}
|
@@ -12,6 +12,9 @@ CONFIG_ENABLE_PROMOTION_ROUTE = (
|
|
12
12
|
"ckanext.search_tweaks.field_relevance.blueprint.promotion.enabled"
|
13
13
|
)
|
14
14
|
CONFIG_PROMOTION_PATH = "ckanext.search_tweaks.field_relevance.blueprint.promotion.path"
|
15
|
+
CONFIG_MIN_PROMOTION = (
|
16
|
+
"ckanext.search_tweaks.field_relevance.blueprint.promotion.min_value"
|
17
|
+
)
|
15
18
|
CONFIG_MAX_PROMOTION = (
|
16
19
|
"ckanext.search_tweaks.field_relevance.blueprint.promotion.max_value"
|
17
20
|
)
|
@@ -21,6 +24,7 @@ CONFIG_PROMOTION_FIELD = (
|
|
21
24
|
|
22
25
|
DEFAULT_ENABLE_PROMOTION_ROUTE = False
|
23
26
|
DEFAULT_PROMOTION_PATH = "/dataset/promote/<id>"
|
27
|
+
DEFAULT_MIN_PROMOTION = 0
|
24
28
|
DEFAULT_MAX_PROMOTION = 100
|
25
29
|
DEFAULT_PROMOTION_FIELD = "promotion_level"
|
26
30
|
|
@@ -40,7 +44,7 @@ class PromoteView(MethodView):
|
|
40
44
|
schema = {
|
41
45
|
field: [
|
42
46
|
tk.get_validator("convert_int"),
|
43
|
-
tk.get_validator("
|
47
|
+
tk.get_validator("int_validator"),
|
44
48
|
tk.get_validator("limit_to_configured_maximum")(
|
45
49
|
CONFIG_MAX_PROMOTION, DEFAULT_MAX_PROMOTION,
|
46
50
|
),
|
@@ -79,6 +83,10 @@ class PromoteView(MethodView):
|
|
79
83
|
"pkg_dict": pkg_dict,
|
80
84
|
"errors": errors or {},
|
81
85
|
"data": data or pkg_dict,
|
86
|
+
"min_promotion": tk.asint(
|
87
|
+
tk.config.get(CONFIG_MIN_PROMOTION, DEFAULT_MIN_PROMOTION),
|
88
|
+
),
|
89
|
+
|
82
90
|
"max_promotion": tk.asint(
|
83
91
|
tk.config.get(CONFIG_MAX_PROMOTION, DEFAULT_MAX_PROMOTION),
|
84
92
|
),
|
@@ -0,0 +1,29 @@
|
|
1
|
+
version: 1
|
2
|
+
groups:
|
3
|
+
- annotation: "ckanext-search-tweaks: query popularity"
|
4
|
+
options:
|
5
|
+
- key: ckanext.search_tweaks.query_popularity.skip_irrefutable_search
|
6
|
+
type: bool
|
7
|
+
default: true
|
8
|
+
|
9
|
+
- key: ckanext.search_tweaks.query_popularity.ignored_symbols
|
10
|
+
default: ":"
|
11
|
+
|
12
|
+
- key: ckanext.search_tweaks.query_popularity.ignored_terms
|
13
|
+
type: list
|
14
|
+
|
15
|
+
- key: ckanext.search_tweaks.query_popularity.tracked_endpoints
|
16
|
+
type: list
|
17
|
+
default: dataset.search
|
18
|
+
|
19
|
+
- key: ckanext.search_tweaks.query_popularity.query_throttle
|
20
|
+
type: int
|
21
|
+
default: 86_400 # 24 hours
|
22
|
+
|
23
|
+
- key: ckanext.search_tweaks.query_popularity.max_age
|
24
|
+
type: int
|
25
|
+
default: 2_592_000 # 30 days
|
26
|
+
|
27
|
+
- key: ckanext.search_tweaks.query_popularity.obsoletion_period
|
28
|
+
type: int
|
29
|
+
default: 86_400 # 24 hours
|
@@ -1,16 +1,21 @@
|
|
1
|
+
from __future__ import annotations
|
2
|
+
|
1
3
|
import csv
|
2
4
|
import datetime
|
3
|
-
|
5
|
+
import logging
|
4
6
|
import click
|
5
7
|
import freezegun
|
6
8
|
|
7
9
|
import ckan.model as model
|
8
10
|
from ckan.lib.redis import connect_to_redis
|
11
|
+
from ckan.lib.search import rebuild
|
9
12
|
|
10
13
|
from . import QueryScore
|
11
14
|
|
12
15
|
_search_csv_headers = ["package_id", "search_query", "count_of_hits"]
|
13
16
|
|
17
|
+
log = logging.getLogger(__name__)
|
18
|
+
|
14
19
|
|
15
20
|
@click.group(short_help="Manage search relevance")
|
16
21
|
def query():
|
@@ -86,3 +91,18 @@ def safe_export(ctx, days, file):
|
|
86
91
|
fg="red",
|
87
92
|
)
|
88
93
|
ctx.invoke(import_source, source=click.File()(file))
|
94
|
+
|
95
|
+
|
96
|
+
@query.command()
|
97
|
+
def index():
|
98
|
+
"""Re-index datasets that have query relevance scores.
|
99
|
+
"""
|
100
|
+
|
101
|
+
storage = QueryScore.default_storage_class()
|
102
|
+
ids = {id for id, _, _ in storage.scan()}
|
103
|
+
with click.progressbar(ids) as bar:
|
104
|
+
for id in bar:
|
105
|
+
try:
|
106
|
+
rebuild(id)
|
107
|
+
except Exception:
|
108
|
+
log.exception("Cannot index %s", id)
|
@@ -49,24 +49,14 @@ class QueryRelevancePlugin(plugins.SingletonPlugin):
|
|
49
49
|
# ISearchTweaks
|
50
50
|
|
51
51
|
def get_search_boost_fn(self, search_params: dict[str, Any]) -> str | None:
|
52
|
-
if feature_disabled("query_boost", search_params):
|
53
|
-
return None
|
54
|
-
|
55
|
-
prefix = tk.config.get(CONFIG_RELEVANCE_PREFIX, DEFAULT_RELEVANCE_PREFIX)
|
56
|
-
disabled = tk.asbool(
|
57
|
-
search_params.get("extras", {}).get(
|
58
|
-
"ext_search_tweaks_disable_relevance",
|
59
|
-
False,
|
60
|
-
),
|
61
|
-
)
|
62
|
-
|
63
|
-
if not search_params.get("q") or disabled:
|
52
|
+
if feature_disabled("query_boost", search_params) or not search_params.get("q"):
|
64
53
|
return None
|
65
54
|
|
66
55
|
normalized = normalize_query(search_params["q"]).replace(" ", "_")
|
67
56
|
if not normalized:
|
68
57
|
return None
|
69
58
|
|
59
|
+
prefix = tk.config.get(CONFIG_RELEVANCE_PREFIX, DEFAULT_RELEVANCE_PREFIX)
|
70
60
|
field = prefix + normalized
|
71
61
|
boost_string = Template(
|
72
62
|
tk.config.get(CONFIG_BOOST_STRING, DEFAULT_BOOST_STRING),
|
{ckanext_search_tweaks-0.6.2 → ckanext_search_tweaks-0.6.3/ckanext_search_tweaks.egg-info}/PKG-INFO
RENAMED
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: ckanext-search-tweaks
|
3
|
-
Version: 0.6.
|
3
|
+
Version: 0.6.3
|
4
4
|
Author-email: DataShades <datashades@linkdigital.com.au>, Sergey Motornyuk <sergey.motornyuk@linkdigital.com.au>
|
5
5
|
Maintainer-email: DataShades <datashades@linkdigital.com.au>
|
6
6
|
License: AGPL
|
@@ -9,6 +9,7 @@ ckanext/__init__.py
|
|
9
9
|
ckanext/search_tweaks/__init__.py
|
10
10
|
ckanext/search_tweaks/cli.py
|
11
11
|
ckanext/search_tweaks/config.py
|
12
|
+
ckanext/search_tweaks/config_declaration.yaml
|
12
13
|
ckanext/search_tweaks/interfaces.py
|
13
14
|
ckanext/search_tweaks/plugin.py
|
14
15
|
ckanext/search_tweaks/shared.py
|
@@ -26,6 +27,7 @@ ckanext/search_tweaks/field_relevance/assets/webassets.yml
|
|
26
27
|
ckanext/search_tweaks/field_relevance/templates/search_tweaks/field_relevance/promote.html
|
27
28
|
ckanext/search_tweaks/query_popularity/__init__.py
|
28
29
|
ckanext/search_tweaks/query_popularity/config.py
|
30
|
+
ckanext/search_tweaks/query_popularity/config_declaration.yaml
|
29
31
|
ckanext/search_tweaks/query_popularity/plugin.py
|
30
32
|
ckanext/search_tweaks/query_popularity/score.py
|
31
33
|
ckanext/search_tweaks/query_popularity/logic/__init__.py
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
4
4
|
|
5
5
|
[project]
|
6
6
|
name = "ckanext-search-tweaks"
|
7
|
-
version = "0.6.
|
7
|
+
version = "0.6.3"
|
8
8
|
description = ""
|
9
9
|
classifiers = [ "Development Status :: 4 - Beta", "License :: OSI Approved :: GNU Affero General Public License v3 or later (AGPLv3+)", "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10",]
|
10
10
|
keywords = [ "CKAN",]
|
File without changes
|
File without changes
|
File without changes
|
{ckanext_search_tweaks-0.6.2 → ckanext_search_tweaks-0.6.3}/ckanext/search_tweaks/__init__.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{ckanext_search_tweaks-0.6.2 → ckanext_search_tweaks-0.6.3}/ckanext/search_tweaks/interfaces.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{ckanext_search_tweaks-0.6.2 → ckanext_search_tweaks-0.6.3}/ckanext/search_tweaks/spellcheck/cli.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{ckanext_search_tweaks-0.6.2 → ckanext_search_tweaks-0.6.3}/ckanext/search_tweaks/tests/__init__.py
RENAMED
File without changes
|
{ckanext_search_tweaks-0.6.2 → ckanext_search_tweaks-0.6.3}/ckanext/search_tweaks/tests/conftest.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|