Skip to content

Commit adfecb6

Browse files
committed
Replace middleman-search with lunr with Typesense DocSearch
Signed-off-by: Takuya Noguchi <[email protected]>
1 parent b6a9b36 commit adfecb6

File tree

11 files changed

+18
-319
lines changed

11 files changed

+18
-319
lines changed

Gemfile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ gem 'middleman', '~> 4.4'
66
gem 'middleman-syntax'
77
gem 'middleman-blog'
88
gem 'puma', '~> 5.6'
9-
gem 'middleman-search', github: 'deivid-rodriguez/middleman-search', branch: 'workarea-commerce-master'
109
gem 'rake'
1110
gem 'ronn'
1211
gem 'kramdown'

Gemfile.lock

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,3 @@
1-
GIT
2-
remote: https://github.com/deivid-rodriguez/middleman-search.git
3-
revision: 50465e1c1580e282a45247b77036da3c2719870d
4-
branch: workarea-commerce-master
5-
specs:
6-
middleman-search (0.10.0)
7-
middleman-core (>= 3.2)
8-
mini_racer (~> 0.5)
9-
nokogiri (~> 1.6)
10-
111
GEM
122
remote: https://rubygems.org/
133
specs:
@@ -52,9 +42,6 @@ GEM
5242
json (2.6.2)
5343
kramdown (2.4.0)
5444
rexml
55-
libv8-node (16.10.0.0)
56-
libv8-node (16.10.0.0-arm64-darwin)
57-
libv8-node (16.10.0.0-x86_64-linux)
5845
listen (3.0.8)
5946
rb-fsevent (~> 0.9, >= 0.9.4)
6047
rb-inotify (~> 0.9, >= 0.9.7)
@@ -101,8 +88,6 @@ GEM
10188
middleman-core (>= 3.2)
10289
rouge (~> 3.2)
10390
mini_portile2 (2.8.0)
104-
mini_racer (0.5.0)
105-
libv8-node (~> 16.10.0.0)
10691
minitest (5.14.4)
10792
mustache (1.0.5)
10893
nio4r (2.5.8)
@@ -193,7 +178,6 @@ DEPENDENCIES
193178
kramdown
194179
middleman (~> 4.4)
195180
middleman-blog
196-
middleman-search!
197181
middleman-syntax
198182
nokogiri (~> 1.13)
199183
octokit (~> 5.1)

assets/javascripts/application.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
import './search'
2-
import './search_arrows'
31
import AnchorJS from 'anchor-js';
42

3+
import "./docsearch";
4+
55
const anchors = new AnchorJS();
66

77
anchors.options = {

assets/javascripts/docsearch.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
docsearch({
2+
inputSelector: "#input-search",
3+
typesenseCollectionName: "bundler",
4+
typesenseServerConfig: {
5+
nodes: [{
6+
host: "k0cw8zgj4i592lsqp-1.a1.typesense.net",
7+
protocol: "https",
8+
}],
9+
apiKey: "kWCn88g6vUwWdBVgEPPYUP9WSIGoqljS",
10+
},
11+
});

assets/javascripts/search.js

Lines changed: 0 additions & 146 deletions
This file was deleted.

assets/javascripts/search_arrows.js

Lines changed: 0 additions & 93 deletions
This file was deleted.

assets/stylesheets/_search.scss

Lines changed: 0 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -31,45 +31,3 @@
3131
.input-search:focus {
3232
outline: 0;
3333
}
34-
35-
.search-list-ul {
36-
list-style-type: none;
37-
padding-left: 0;
38-
39-
hr {
40-
margin-top: 0;
41-
margin-bottom: 0;
42-
}
43-
44-
li:last-child hr {
45-
height: 0;
46-
border-top-color: #ffffff;
47-
}
48-
49-
h4 {
50-
padding-top: 10px;
51-
margin-bottom: 0;
52-
}
53-
54-
.active {
55-
border: 2px solid #64C9EF !important;
56-
57-
transition-property: border-color;
58-
transition-duration: 0.3s;
59-
-webkit-transition-property: border-color;
60-
-webkit-transition-duration: 0.3s;
61-
-o-transition-property: border-color;
62-
-o-transition-duration: 0.3s;
63-
-moz-transition-property: border-color;
64-
-moz-transition-duration: 0.3s;
65-
}
66-
67-
.search-list-li {
68-
border: 2px solid transparent;
69-
padding: 2px;
70-
}
71-
}
72-
73-
.popover{
74-
max-width: 100%; /* Max Width of the popover (depending on the container!) */
75-
}

assets/stylesheets/application.css.scss

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ $icon-font-path: '~bootstrap/assets/fonts/bootstrap/';
4848
@import "~bootstrap/scss/nav";
4949
@import "~bootstrap/scss/navbar";
5050
@import "~bootstrap/scss/card";
51-
@import "~bootstrap/scss/popover";
5251

5352
// Helpers
5453
@import "~bootstrap/scss/helpers";

config.rb

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,6 @@
55

66
activate :syntax
77
activate :i18n
8-
activate :search do |search|
9-
search.resources = ['index.html', 'guides/', "#{config[:current_version]}/", 'compatibility.html', 'conduct.html', 'contributors.html']
10-
11-
search.index_path = 'search/lunr-index.json'
12-
13-
search.fields = {
14-
title: {boost: 100, store: true, required: true},
15-
content: {boost: 50},
16-
url: {index: false, store: true},
17-
description: {index: false, store: true},
18-
}
19-
end
208

219
set :markdown_engine, :kramdown
2210

source/layouts/_navbar.haml

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,9 @@
33
= link_to 'Bundler', '/', class: "navbar-brand me-auto fw-bold"
44
%button.navbar-toggler{type: "button", "data-bs-toggle": "collapse", "data-bs-target": "#bs-navbar-collapse", "aria-controls": "bs-navbar-collapse", "aria-expanded": "false", "aria-label": "Toggle navigation"}
55
%span.navbar-toggler-icon
6+
.mx-3#docsearch
67
.collapse.navbar-collapse.flex-grow-0#bs-navbar-collapse
78
%ul.navbar-nav
8-
%li.nav-item
9-
%input#input-search.input-search.my-1.ps-1.pt-1{type: :text, placeholder: t('search.placeholder')}
10-
%svg.text-opacity-40.m-1.mb-2{xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 512 512", style: "width: 1rem; height: 1rem; fill: currentcolor;"}
11-
/ Font Awesome Free 6.1.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2022 Fonticons, Inc.
12-
%path{d: "M500.3 443.7l-119.7-119.7c27.22-40.41 40.65-90.9 33.46-144.7C401.8 87.79 326.8 13.32 235.2 1.723C99.01-15.51-15.51 99.01 1.724 235.2c11.6 91.64 86.08 166.7 177.6 178.9c53.8 7.189 104.3-6.236 144.7-33.46l119.7 119.7c15.62 15.62 40.95 15.62 56.57 0C515.9 484.7 515.9 459.3 500.3 443.7zM79.1 208c0-70.58 57.42-128 128-128s128 57.42 128 128c0 70.58-57.42 128-128 128S79.1 278.6 79.1 208z"}
139
%li.nav-item= link_to t('navbar.docs'), '/docs.html', class: "nav-link"
1410
%li.nav-item= link_to t('navbar.team'), '/contributors.html', class: "nav-link"
1511
%li.nav-item= link_to t('navbar.blog'), '/blog', class: "nav-link"

0 commit comments

Comments
 (0)