jekyll_ranked_search 0.0.3 → 0.0.4
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 +4 -4
- data/lib/search.js +8 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: aa336a48a9eb94c3a0e7e395dee1a9c4a7938339cfa800e528db49b3c2876953
|
4
|
+
data.tar.gz: ced1e0e9cd3919a5a5fc28848c80523a81987698c11b0be0b4ea487f5f3ca3a7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f87c796fa346ac49d87bb939ee85ed37cfbe4083954a2963e2fb04e95963b87e0b95d2b5b03356364a1ce84f59d366fc74477e65fd532f1808ed272b810cda22
|
7
|
+
data.tar.gz: 811a1bebdcbef011282022bfe7083d2284d0c690132aad7a79431fd01fd0548144540f8499c61e04458e6f93ab1b29f4a61a3d05c220e5fede490ce7c05d5861
|
data/lib/search.js
CHANGED
@@ -12,6 +12,9 @@ class SearchBox extends LitElement {
|
|
12
12
|
|
13
13
|
// Lazy loading
|
14
14
|
lazy: {type: Boolean, attribute: true},
|
15
|
+
|
16
|
+
// Maximum number of results to show
|
17
|
+
maxResults: {type: Number, attribute: "max-results"},
|
15
18
|
};
|
16
19
|
|
17
20
|
/**
|
@@ -35,6 +38,9 @@ class SearchBox extends LitElement {
|
|
35
38
|
// Disable lazy loading by default
|
36
39
|
this.lazy = false;
|
37
40
|
|
41
|
+
// Default to maximum of 8 results
|
42
|
+
this.maxResults = 8;
|
43
|
+
|
38
44
|
this._placeholder = "Search...";
|
39
45
|
}
|
40
46
|
|
@@ -62,6 +68,7 @@ class SearchBox extends LitElement {
|
|
62
68
|
margin-top: 4px;
|
63
69
|
z-index: 10;
|
64
70
|
background-color: #F6F6F6;
|
71
|
+
overflow: hidden;
|
65
72
|
border-radius: 4px;
|
66
73
|
box-shadow: 1px 1px 2px #888;
|
67
74
|
}
|
@@ -208,7 +215,7 @@ class SearchBox extends LitElement {
|
|
208
215
|
const candidates = [...results.entries()].sort((a, b) => b[1] - a[1]).map((a) => a[0]);
|
209
216
|
|
210
217
|
// Get top n results
|
211
|
-
this._results = candidates.map((idx) => this._data.docs[idx]).slice(0,
|
218
|
+
this._results = candidates.map((idx) => this._data.docs[idx]).slice(0, this.maxResults);
|
212
219
|
this._open = true;
|
213
220
|
}
|
214
221
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jekyll_ranked_search
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Friedrich Ewald
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-07-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: redcarpet
|