Skip to content

Commit

Permalink
Replace middleman-search with lunr with Typesense DocSearch
Browse files Browse the repository at this point in the history
Signed-off-by: Takuya Noguchi <takninnovationresearch@gmail.com>
  • Loading branch information
tnir committed Jul 23, 2022
1 parent b6a9b36 commit 0b2e6e1
Show file tree
Hide file tree
Showing 10 changed files with 16 additions and 314 deletions.
1 change: 0 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ gem 'middleman', '~> 4.4'
gem 'middleman-syntax'
gem 'middleman-blog'
gem 'puma', '~> 5.6'
gem 'middleman-search', github: 'deivid-rodriguez/middleman-search', branch: 'workarea-commerce-master'
gem 'rake'
gem 'ronn'
gem 'kramdown'
Expand Down
16 changes: 0 additions & 16 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,13 +1,3 @@
GIT
remote: https://github.com/deivid-rodriguez/middleman-search.git
revision: 50465e1c1580e282a45247b77036da3c2719870d
branch: workarea-commerce-master
specs:
middleman-search (0.10.0)
middleman-core (>= 3.2)
mini_racer (~> 0.5)
nokogiri (~> 1.6)

GEM
remote: https://rubygems.org/
specs:
Expand Down Expand Up @@ -52,9 +42,6 @@ GEM
json (2.6.2)
kramdown (2.4.0)
rexml
libv8-node (16.10.0.0)
libv8-node (16.10.0.0-arm64-darwin)
libv8-node (16.10.0.0-x86_64-linux)
listen (3.0.8)
rb-fsevent (~> 0.9, >= 0.9.4)
rb-inotify (~> 0.9, >= 0.9.7)
Expand Down Expand Up @@ -101,8 +88,6 @@ GEM
middleman-core (>= 3.2)
rouge (~> 3.2)
mini_portile2 (2.8.0)
mini_racer (0.5.0)
libv8-node (~> 16.10.0.0)
minitest (5.14.4)
mustache (1.0.5)
nio4r (2.5.8)
Expand Down Expand Up @@ -193,7 +178,6 @@ DEPENDENCIES
kramdown
middleman (~> 4.4)
middleman-blog
middleman-search!
middleman-syntax
nokogiri (~> 1.13)
octokit (~> 5.1)
Expand Down
4 changes: 2 additions & 2 deletions assets/javascripts/application.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import './search'
import './search_arrows'
import AnchorJS from 'anchor-js';

import "./typesenseDocsearch";

const anchors = new AnchorJS();

anchors.options = {
Expand Down
146 changes: 0 additions & 146 deletions assets/javascripts/search.js

This file was deleted.

93 changes: 0 additions & 93 deletions assets/javascripts/search_arrows.js

This file was deleted.

11 changes: 11 additions & 0 deletions assets/javascripts/typesenseDocsearch.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
docsearch({
inputSelector: "#input-search",
typesenseCollectionName: "bundler",
typesenseServerConfig: {
nodes: [{
host: "ijmv1s078hbwfl9zp-1.a1.typesense.net",
protocol: "https",
}],
apiKey: "p7DMHdxzgPnJD27zDaY42ByNn9IQQxCv",
},
});
42 changes: 0 additions & 42 deletions assets/stylesheets/_search.scss
Original file line number Diff line number Diff line change
Expand Up @@ -31,45 +31,3 @@
.input-search:focus {
outline: 0;
}

.search-list-ul {
list-style-type: none;
padding-left: 0;

hr {
margin-top: 0;
margin-bottom: 0;
}

li:last-child hr {
height: 0;
border-top-color: #ffffff;
}

h4 {
padding-top: 10px;
margin-bottom: 0;
}

.active {
border: 2px solid #64C9EF !important;

transition-property: border-color;
transition-duration: 0.3s;
-webkit-transition-property: border-color;
-webkit-transition-duration: 0.3s;
-o-transition-property: border-color;
-o-transition-duration: 0.3s;
-moz-transition-property: border-color;
-moz-transition-duration: 0.3s;
}

.search-list-li {
border: 2px solid transparent;
padding: 2px;
}
}

.popover{
max-width: 100%; /* Max Width of the popover (depending on the container!) */
}
1 change: 0 additions & 1 deletion assets/stylesheets/application.css.scss
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ $icon-font-path: '~bootstrap/assets/fonts/bootstrap/';
@import "~bootstrap/scss/nav";
@import "~bootstrap/scss/navbar";
@import "~bootstrap/scss/card";
@import "~bootstrap/scss/popover";

// Helpers
@import "~bootstrap/scss/helpers";
Expand Down
12 changes: 0 additions & 12 deletions config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,6 @@

activate :syntax
activate :i18n
activate :search do |search|
search.resources = ['index.html', 'guides/', "#{config[:current_version]}/", 'compatibility.html', 'conduct.html', 'contributors.html']

search.index_path = 'search/lunr-index.json'

search.fields = {
title: {boost: 100, store: true, required: true},
content: {boost: 50},
url: {index: false, store: true},
description: {index: false, store: true},
}
end

set :markdown_engine, :kramdown

Expand Down
Loading

0 comments on commit 0b2e6e1

Please sign in to comment.