card-mod-search 0.17.0 → 0.18.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/set/abstract/0_search/search_params.rb +18 -0
- data/set/abstract/0_search/views.rb +10 -20
- data/set/abstract/0_search.rb +2 -0
- data/set/abstract/cql_search.rb +7 -1
- data/set/all/autocomplete.rb +6 -0
- data/set/right/mates.rb +8 -5
- data/set/self/search.rb +0 -8
- metadata +12 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2b984c349feeb19b84a22304807c81954763bd0231d9058e74fc1d486a332cdf
|
4
|
+
data.tar.gz: 86aca9cc8d4c5f2f420cc15a2974d41133ea480e13de55353c2534e673031479
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7df1ccbc3dd598c4638e96b11b1ebb557cc42214c680589d19e52e04f969ea794b9298b8701d259b853792b757a8f940a1e196f445c5735c0cca5859d89f974e
|
7
|
+
data.tar.gz: 9f7244334094de50ee81a26d2f112362fc7d52f8c3f1b333f1324a5bd52cdbaefb3a7bbc5328e1ce23c7688ee23df9707930c92095d88e1f1614d74c154d873c
|
@@ -20,6 +20,24 @@ format do
|
|
20
20
|
(vars = params[:query]) ? Env.hash(vars) : {}
|
21
21
|
end
|
22
22
|
|
23
|
+
def type_param
|
24
|
+
type = query_params[:type]
|
25
|
+
type.present? && type
|
26
|
+
end
|
27
|
+
|
28
|
+
def term_param
|
29
|
+
params[:term]
|
30
|
+
end
|
31
|
+
|
32
|
+
def search_keyword
|
33
|
+
@search_keyword ||= term_param || search_vars&.dig(:keyword)
|
34
|
+
end
|
35
|
+
|
36
|
+
def search_vars
|
37
|
+
# root.respond_to?(:search_params) ? root.search_params[:vars] :
|
38
|
+
search_params[:vars]
|
39
|
+
end
|
40
|
+
|
23
41
|
def default_limit
|
24
42
|
100
|
25
43
|
end
|
@@ -8,9 +8,7 @@ format do
|
|
8
8
|
end
|
9
9
|
|
10
10
|
view :card_list, cache: :never do
|
11
|
-
|
12
|
-
"no results"
|
13
|
-
else
|
11
|
+
with_results do
|
14
12
|
search_with_params.map do |item_card|
|
15
13
|
nest_item item_card
|
16
14
|
end.join "\n"
|
@@ -28,15 +26,9 @@ format do
|
|
28
26
|
def item_cards
|
29
27
|
search_with_params
|
30
28
|
end
|
31
|
-
|
32
|
-
def term_param
|
33
|
-
params[:term]
|
34
|
-
end
|
35
29
|
end
|
36
30
|
|
37
31
|
format :json do
|
38
|
-
AUTOCOMPLETE_LIMIT = 8 # number of name suggestions for autocomplete text fields
|
39
|
-
|
40
32
|
# NOCACHE because paging_urls is uncacheable hash and thus not safe to merge
|
41
33
|
view :molecule, cache: :never do
|
42
34
|
molecule.merge render_paging_urls
|
@@ -80,7 +72,7 @@ format :json do
|
|
80
72
|
end
|
81
73
|
|
82
74
|
def complete_cql
|
83
|
-
|
75
|
+
{ complete: term_param.to_s }
|
84
76
|
end
|
85
77
|
|
86
78
|
def match_cql not_names
|
@@ -112,15 +104,17 @@ end
|
|
112
104
|
|
113
105
|
format :html do
|
114
106
|
view :card_list, cache: :never do
|
115
|
-
|
116
|
-
|
117
|
-
|
107
|
+
klasses = "card-list card-list-#{item_view_options[:view]} search-result-list"
|
108
|
+
search_result_list(klasses) do
|
109
|
+
search_with_params.map do |item_card|
|
110
|
+
card_list_item item_card
|
111
|
+
end
|
118
112
|
end
|
119
113
|
end
|
120
114
|
|
121
115
|
view :checkbox_list, cache: :never do
|
122
|
-
|
123
|
-
|
116
|
+
search_result_list "_search-checkbox-list pe-2" do
|
117
|
+
search_with_params.map do |item_card|
|
124
118
|
checkbox_item item_card
|
125
119
|
end
|
126
120
|
end
|
@@ -139,11 +133,7 @@ format :html do
|
|
139
133
|
end
|
140
134
|
|
141
135
|
def search_result_list klass, &block
|
142
|
-
with_paging
|
143
|
-
wrap_with :div, class: klass do
|
144
|
-
search_with_params.map(&block)
|
145
|
-
end
|
146
|
-
end
|
136
|
+
with_results { with_paging { wrap_with :div, class: klass, &block } }
|
147
137
|
end
|
148
138
|
|
149
139
|
def checkbox_item item_card
|
data/set/abstract/0_search.rb
CHANGED
data/set/abstract/cql_search.rb
CHANGED
@@ -13,7 +13,7 @@ end
|
|
13
13
|
|
14
14
|
def item_type_id
|
15
15
|
type = cql_hash[:type]
|
16
|
-
type = type&.card_id
|
16
|
+
type = type&.card_id if plausible_type? type
|
17
17
|
type if type.is_a? Integer
|
18
18
|
end
|
19
19
|
|
@@ -65,12 +65,18 @@ def query args={}
|
|
65
65
|
Query.new standardized_query_args(args), name
|
66
66
|
end
|
67
67
|
|
68
|
+
private
|
69
|
+
|
68
70
|
def standardized_query_args args
|
69
71
|
args = cql_hash.merge args.symbolize_keys
|
70
72
|
args[:context] ||= name
|
71
73
|
args
|
72
74
|
end
|
73
75
|
|
76
|
+
def plausible_type? type
|
77
|
+
type.class.in?([String, Symbol, Integer]) && type != "_left"
|
78
|
+
end
|
79
|
+
|
74
80
|
format do
|
75
81
|
def default_limit
|
76
82
|
card_content_limit || super
|
data/set/all/autocomplete.rb
CHANGED
data/set/right/mates.rb
CHANGED
@@ -1,5 +1,8 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
1
|
+
# too slow on large databases.
|
2
|
+
# requires joining cards to cards to cards.
|
3
|
+
|
4
|
+
# include_set Abstract::VirtualSearch,
|
5
|
+
# cql_content: { plus: "_left", sort_by: "name" },
|
6
|
+
# raw_help_text:
|
7
|
+
# 'If there is a card named "X+{{_left|name}}", ' \
|
8
|
+
# "then X is a mate of {{_left|name}}."
|
data/set/self/search.rb
CHANGED
@@ -19,14 +19,6 @@ format do
|
|
19
19
|
rescuing_bad_query(query) { Card.search query }
|
20
20
|
end
|
21
21
|
|
22
|
-
def search_keyword
|
23
|
-
@search_keyword ||= term_param || search_vars&.dig(:keyword)
|
24
|
-
end
|
25
|
-
|
26
|
-
def search_vars
|
27
|
-
root.respond_to?(:search_params) ? root.search_params[:vars] : search_params[:vars]
|
28
|
-
end
|
29
|
-
|
30
22
|
def cql_keyword?
|
31
23
|
search_keyword&.match?(/^\{.+\}$/)
|
32
24
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: card-mod-search
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.18.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ethan McCutchen
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2024-
|
13
|
+
date: 2024-10-31 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: card
|
@@ -18,56 +18,56 @@ dependencies:
|
|
18
18
|
requirements:
|
19
19
|
- - '='
|
20
20
|
- !ruby/object:Gem::Version
|
21
|
-
version: 1.
|
21
|
+
version: 1.108.0
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
24
|
version_requirements: !ruby/object:Gem::Requirement
|
25
25
|
requirements:
|
26
26
|
- - '='
|
27
27
|
- !ruby/object:Gem::Version
|
28
|
-
version: 1.
|
28
|
+
version: 1.108.0
|
29
29
|
- !ruby/object:Gem::Dependency
|
30
30
|
name: card-mod-collection
|
31
31
|
requirement: !ruby/object:Gem::Requirement
|
32
32
|
requirements:
|
33
33
|
- - '='
|
34
34
|
- !ruby/object:Gem::Version
|
35
|
-
version: 0.
|
35
|
+
version: 0.18.0
|
36
36
|
type: :runtime
|
37
37
|
prerelease: false
|
38
38
|
version_requirements: !ruby/object:Gem::Requirement
|
39
39
|
requirements:
|
40
40
|
- - '='
|
41
41
|
- !ruby/object:Gem::Version
|
42
|
-
version: 0.
|
42
|
+
version: 0.18.0
|
43
43
|
- !ruby/object:Gem::Dependency
|
44
44
|
name: card-mod-format
|
45
45
|
requirement: !ruby/object:Gem::Requirement
|
46
46
|
requirements:
|
47
47
|
- - '='
|
48
48
|
- !ruby/object:Gem::Version
|
49
|
-
version: 0.
|
49
|
+
version: 0.18.0
|
50
50
|
type: :runtime
|
51
51
|
prerelease: false
|
52
52
|
version_requirements: !ruby/object:Gem::Requirement
|
53
53
|
requirements:
|
54
54
|
- - '='
|
55
55
|
- !ruby/object:Gem::Version
|
56
|
-
version: 0.
|
56
|
+
version: 0.18.0
|
57
57
|
- !ruby/object:Gem::Dependency
|
58
58
|
name: card-mod-help
|
59
59
|
requirement: !ruby/object:Gem::Requirement
|
60
60
|
requirements:
|
61
61
|
- - '='
|
62
62
|
- !ruby/object:Gem::Version
|
63
|
-
version: 0.
|
63
|
+
version: 0.18.0
|
64
64
|
type: :runtime
|
65
65
|
prerelease: false
|
66
66
|
version_requirements: !ruby/object:Gem::Requirement
|
67
67
|
requirements:
|
68
68
|
- - '='
|
69
69
|
- !ruby/object:Gem::Version
|
70
|
-
version: 0.
|
70
|
+
version: 0.18.0
|
71
71
|
description: ''
|
72
72
|
email:
|
73
73
|
- info@decko.org
|
@@ -122,7 +122,7 @@ files:
|
|
122
122
|
- set/type/search_type.rb
|
123
123
|
homepage: https://decko.org
|
124
124
|
licenses:
|
125
|
-
- GPL-3.0
|
125
|
+
- GPL-3.0-or-later
|
126
126
|
metadata:
|
127
127
|
source_code_uri: https://github.com/decko-commons/decko
|
128
128
|
homepage_uri: https://decko.org
|
@@ -146,7 +146,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
146
146
|
- !ruby/object:Gem::Version
|
147
147
|
version: '0'
|
148
148
|
requirements: []
|
149
|
-
rubygems_version: 3.5.
|
149
|
+
rubygems_version: 3.5.7
|
150
150
|
signing_key:
|
151
151
|
specification_version: 4
|
152
152
|
summary: search
|