Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add lunr-gr.js and fix lunr-en.js #1445

Merged
merged 3 commits into from
Jan 3, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions _data/ui-text.yml
Original file line number Diff line number Diff line change
Expand Up @@ -662,6 +662,8 @@ gr: &DEFAULT_GR
comment_success_msg : "Ευχαριστούμε για το σχόλιό σας! Θα εμφανιστεί στην ιστοσελίδα αφού εγκριθεί."
comment_error_msg : "Λυπούμαστε, παρουσιάστηκε σφάλμα με την υποβολή σας. Παρακαλούμε βεβαιωθείτε ότι έχετε όλα τα απαιτούμενα πεδία συμπληρωμένα και δοκιμάστε ξανά."
loading_label : "Φόρτωση..."
search_placeholder_text : "Εισάγετε όρο αναζήτησης..."
results_found : "Αποτελέσματα"
gr-GR:
<<: *DEFAULT_GR

Expand Down
3 changes: 2 additions & 1 deletion _includes/scripts.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@
{% endif %}

{% if site.search == true or page.layout == 'search' %}
{% assign lang = site.locale | slice: 0,2 | default: "en" %}
<script src="{{ '/assets/js/lunr.min.js' | absolute_url }}"></script>
<script src="{{ '/assets/js/lunr-en.js' | absolute_url }}"></script>
<script src="{{ '/assets/js/lunr-' | append: lang | append: '.js' | absolute_url }}"></script>
{% endif %}

{% include analytics.html %}
Expand Down
4 changes: 3 additions & 1 deletion assets/js/lunr-en.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ var idx = lunr(function () {
this.field('tags')
this.ref('id')

this.pipeline.remove(lunr.trimmer)

{% assign count = 0 %}
{% for c in site.collections %}
{% assign docs = c.docs | where_exp:'doc','doc.search != false' %}
Expand Down Expand Up @@ -56,7 +58,7 @@ var store = [
$(document).ready(function() {
$('input#search').on('keyup', function () {
var resultdiv = $('#results');
var query = $(this).val().toLowerCase().replace(":", "");
var query = $(this).val().toLowerCase();
var result =
idx.query(function (q) {
query.split(lunr.tokenizer.separator).forEach(function (term) {
Expand Down
Loading