I have a Jekyll site for which I use the Simple-Jekyll-Search library to provide searching.
The site is a catalogue composed of many entries characterized, among other things, by their (x, y) position. This is what my search.md
file looks like:
---
layout: page
title: Search
permalink: /search/
---
<div id="search-container">
<input type="text" id="search-input" placeholder="Search the catalogue...">
<ul id="results-container"></ul>
</div>
<script src="{{ site.baseurl }}/assets/simple-jekyll-search.min.js" type="text/javascript"></script>
<script>
SimpleJekyllSearch({
searchInput: document.getElementById('search-input'),
resultsContainer: document.getElementById('results-container'),
searchResultTemplate: '<div style="text-align: left !important;"><a href="{url}"><h1 style="text-align:left !important;">{title}</h1></a></div>',
json: '{{ site.baseurl }}/search.json'
});
</script>
This works perfectly for word-based searches, but I need a way to also search by distance, i.e.:
- the user gives a 2D position (x, y)
- the library displays all the entries in the catalogue whose position (stored in a file somewhere) is within this region that is defined by the (x, y) coordinates plus a fixed search radius.
This site is a great example of what I'm after. Can this be done with some off-the-shelf library? (I can't code in JS)