Skip to content

Commit

Permalink
Issues emberjs#1183, emberjs#1184: Replaced Swiftype with Algolia Doc…
Browse files Browse the repository at this point in the history
…Search

Removed Swiftype gem, scripts and styles.

Added DocSearch scripts and styles.

Changed default DocSearch colours to Ember colours.
  • Loading branch information
jeradg committed Jan 22, 2016
1 parent 5aa5359 commit d97f3eb
Show file tree
Hide file tree
Showing 16 changed files with 247 additions and 781 deletions.
1 change: 0 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ gem "rack"
gem "listen"
gem "builder"
gem "middleman-alias"
gem "middleman-swiftype", :git => "https://github.com/LeonB/middleman-swiftype.git"
gem "underscore-rails"
gem "html-proofer"

Expand Down
14 changes: 0 additions & 14 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,12 +1,3 @@
GIT
remote: https://github.com/LeonB/middleman-swiftype.git
revision: 98a7fdb365cedcaa472caa4dd2132f79f0d7d15b
specs:
middleman-swiftype (0.0.1)
middleman-core (>= 3.0)
nokogiri
swiftype (>= 0.0.4)

GIT
remote: https://github.com/dgeb/coderay.git
revision: 1362fd4af63331aed51ce9907ad7295cea228874
Expand Down Expand Up @@ -189,7 +180,6 @@ GEM
tilt (~> 1.1)
support-for (1.0.3)
sass (~> 3.3)
swiftype (1.2.0)
thin (1.6.4)
daemons (~> 1.0, >= 1.0.9)
eventmachine (~> 1.0, >= 1.0.4)
Expand Down Expand Up @@ -229,7 +219,6 @@ DEPENDENCIES
middleman (~> 3.0)
middleman-alias
middleman-spellcheck!
middleman-swiftype!
neat
normalize-scss
poltergeist
Expand All @@ -244,6 +233,3 @@ DEPENDENCIES
tzinfo-data
underscore-rails
wdm (>= 0.1.0)

BUNDLED WITH
1.10.5
9 changes: 0 additions & 9 deletions config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,6 @@
activate :highlighter
activate :alias

###
# Swiftype
###
def current_guide(mm_instance, current_page)
path = current_page.path.gsub('.html', '')
guide_path = path.split("/")[0]
Expand All @@ -50,12 +47,6 @@ def current_chapter(mm_instance, current_page)
current_chapter
end

activate :swiftype do |swift|
swift.pages_selector = lambda { |p| p.path.match(/\.html/) && p.metadata[:options][:layout] == nil }
swift.title_selector = lambda { |mm_instance, p| return current_chapter(mm_instance, p) == nil ? "" : current_chapter(mm_instance, p).title }
swift.should_index = lambda { |p, title| return title.to_s == '' ? false : true }
end

###
# Build
###
Expand Down
2 changes: 1 addition & 1 deletion data/search.yml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
engine_key: 'UdruvUp_iEcu2wdYqw9D'
api_key: '70c6f2593b56f14e561a361d1b787a1e'
3 changes: 1 addition & 2 deletions source/_header.erb
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,8 @@

<li class="header-search">
<form>
<input type="text" id="st-search-input" class="st-search-input" placeholder="Search the guides"/>
<input type="text" id="search-input" class="search-input" placeholder="Search the guides"/>
</form>
<div id="st-results-container"></div>
</li>
</ul>
</nav>
Expand Down
29 changes: 29 additions & 0 deletions source/javascripts/app/docsearch.js.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
(function() {
var script = document.createElement('script');
script.type = 'text/javascript';
script.async = true;
script.src = '//cdn.jsdelivr.net/docsearch.js/1/docsearch.min.js';
var entry = document.getElementsByTagName('script')[0];
entry.parentNode.insertBefore(script, entry);
}());

window.GUIDE_VERSIONS.onReady(function (versions) {
var currentRevision = versions.current;
var apiKey = '<%= data.search.api_key %>';
var inputSelector = '#search-input';
var indexName = 'emberjs';
var hitsPerPage = 10;
var facetFilters = '(tags:api,tags:' + currentRevision + ')';

$(window).load(function() {
docsearch({
apiKey: apiKey,
indexName: indexName,
inputSelector: inputSelector,
algoliaOptions: {
hitsPerPage: hitsPerPage,
facetFilters: facetFilters
}
});
});
});
49 changes: 0 additions & 49 deletions source/javascripts/app/swiftype.js.erb

This file was deleted.

1 change: 0 additions & 1 deletion source/javascripts/common-all.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
//= require underscore
//= require vendor/getDevicePixelRatio-min
//= require vendor/select2
//= require vendor/jquery.swiftype.autocomplete
//= require_tree ./app
Loading

0 comments on commit d97f3eb

Please sign in to comment.