aboutsummaryrefslogtreecommitdiff
path: root/src/site/plugins/flexsearch.js
blob: 595b1806380fac5870b429ca58a0cec1a52a7d65 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
import Vue from 'vue';
import FlexSearch from 'flexsearch';
const search = new FlexSearch('speed');

// https://github.com/nextapps-de/flexsearch

Vue.prototype.$search = {
	items: async items => {
		await search.clear();
		await search.add(items);
	},
	do: async (term, field) => {
		const results = await search.search(term, { field });
		return results;
	}
};