Skip to content

Commit ee35f18

Browse files
authored
Change the blog-search to https://bs.nanosearch.io (#105)
* Change to https://bs.nanosearch.io * Update variables * Use nanosearch * Improve README
1 parent 56db1b6 commit ee35f18

File tree

9 files changed

+20
-20
lines changed

9 files changed

+20
-20
lines changed

.github/workflows/main.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,9 @@ jobs:
4242
bundle exec jekyll build --trace --baseurl "${{ steps.pages.outputs.base_path }}"
4343
env:
4444
SERVICE_VERSION: "${{ env.SERVICE_VERSION }}"
45-
JIMI_USERNAME: "${{ secrets.JIMI_USERNAME }}"
46-
JIMI_PASSWORD: "${{ secrets.JIMI_PASSWORD }}"
47-
JIMI_ENABLED: true
45+
BS_USERNAME: "${{ secrets.BS_USERNAME }}"
46+
BS_PASSWORD: "${{ secrets.BS_PASSWORD }}"
47+
BS_ENABLED: true
4848
- name: Upload artifact
4949
# Automatically uploads an artifact from the './_site' directory by default
5050
uses: actions/upload-pages-artifact@v1

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -169,12 +169,12 @@ Collection Directory | Description
169169
Indexing documents are done during the build process of the website, usually in
170170
the CI. This is powered by the custom BlogSearch plugin
171171
(`_plugins/hooks/site/post_write/blogsearch.rb`). To debug it, you can set
172-
environment variable `JIMI_ENABLED` and then build/serve the Jekyll website.
173-
Username (`JIMI_USERNAME`) and password (`JIMI_PASSWORD`) are required.
172+
environment variable `BS_ENABLED` and then build/serve the Jekyll website.
173+
Username (`BS_USERNAME`) and password (`BS_PASSWORD`) are required.
174174

175175
### Querying Documents
176176

177-
The search feature is powered by Jimi Search (`jimi`), a custom search solution
177+
The search feature is powered by Nanosearch (`nanosearch`), a custom search solution
178178
that I created based on Java, OpenAPI and Elasticsearch.
179179

180180
## Assets

_config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ pageview:
168168
## => Search
169169
##############################
170170
search:
171-
provider: jimi # "default" (default), false, "google", "custom"
171+
provider: nanosearch # "default" (default), false, "google", "custom"
172172

173173
## Google Custom Search Engine
174174
google:

_includes/scripts/rum.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
// Specify a version number to identify the deployed version of your application in Datadog
1515
version: '{{ site.env.SERVICE_VERSION }}',
1616
sampleRate: 100,
17-
allowedTracingOrigins: ["https://search.jimidata.info"],
17+
allowedTracingOrigins: ["https://bs.nanosearch.io"],
1818
trackInteractions: true,
1919
defaultPrivacyLevel: 'mask-user-input'
2020
});

_includes/search-providers/jimi/search.html renamed to _includes/search-providers/nanosearch/search.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,4 @@
1515
<div class="search-result js-search-result"></div>
1616
</div>
1717
</div>
18-
<script>{%- include search-providers/jimi/search.js -%}</script>
18+
<script>{%- include search-providers/nanosearch/search.js -%}</script>

_includes/search-providers/jimi/search.js renamed to _includes/search-providers/nanosearch/search.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ window.Lazyload.js([SOURCES.jquery, PAHTS.search_js], function() {
3737
function remoteSearchByQuery(query) {
3838
console.log(`searching: ${query}`);
3939
var i, j, key, keys, cur, _title;
40-
const url = 'https://search.jimidata.info/sites/mincong.io/posts/search?' + $.param({
40+
const url = 'https://bs.nanosearch.io/sites/mincong.io/posts/search?' + $.param({
4141
q: query
4242
});
4343
let start = Date.now();

_includes/search.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
{%- include search-providers/default/search.html -%}
1616
{%- elsif site.search.provider == 'google' -%}
1717
{%- include search-providers/google-custom-search-engine/search.html -%}
18-
{%- elsif site.search.provider == 'jimi' -%}
19-
{%- include search-providers/jimi/search.html -%}
18+
{%- elsif site.search.provider == 'nanosearch' -%}
19+
{%- include search-providers/nanosearch/search.html -%}
2020
{%- elsif site.search.provider == 'custom' -%}
2121
{%- include search-providers/custom/search.html -%}
2222
{%- endif -%}

_plugins/hooks/site/post_write/blogsearch.rb

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,19 @@
44

55
Jekyll::Hooks.register :site, :post_write do |site|
66
jekyll_env = ENV["JEKYLL_ENV"]
7-
jimi_enabled_env = ENV["JIMI_ENABLED"]
8-
jimi_enabled = jekyll_env == "prod" || jimi_enabled_env == "true"
7+
blogsearch_enabled_env = ENV["BS_ENABLED"]
8+
blogsearch_enabled = jekyll_env == "prod" || blogsearch_enabled_env == "true"
99

10-
if !jimi_enabled
11-
Jekyll.logger.info "Jimi search is disabled"
10+
if !blogsearch_enabled
11+
Jekyll.logger.info "Blogsearch is disabled"
1212
next
1313
end
1414

1515
Jekyll.logger.info "Updating blog posts to BlogSearch..."
16-
username = ENV["JIMI_USERNAME"]
17-
password = ENV["JIMI_PASSWORD"]
16+
username = ENV["BS_USERNAME"]
17+
password = ENV["BS_PASSWORD"]
1818

19-
site_info = Net::HTTP.get URI('https://search.jimidata.info')
19+
site_info = Net::HTTP.get URI('https://bs.nanosearch.io')
2020
Jekyll.logger.info site_info
2121

2222
# See more variables in https://jekyllrb.com/docs/variables/
@@ -28,7 +28,7 @@
2828

2929
pos = post.id.rindex('/') + 1
3030
postId = post.id[pos..-1] # hack: remove prefix
31-
uri = URI.parse('https://search.jimidata.info/sites/mincong.io/posts/' + postId)
31+
uri = URI.parse('https://bs.nanosearch.io/sites/mincong.io/posts/' + postId)
3232
Jekyll.logger.info uri
3333

3434
http = Net::HTTP.new(uri.host, uri.port)

0 commit comments

Comments
 (0)