aboutsummaryrefslogtreecommitdiff
path: root/src/site/plugins/flexsearch.js
blob: 1c06c8d1b374ae936f5aa6440e55abdfc2fe57ae (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
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;
	}
};