elasticlunr (FAIL)

Fuzzy Text Search Test

by Anov Siradj

HTML

<script src="https://anovsiradj.github.io/webapp.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/elasticlunr/0.9.6/elasticlunr.min.js"></script>

JavaScript

dump.type = 'log';

var keyword = ['izone','gidle'];
var list = [
	`[안방1열 직캠4K] 아이즈원 조유리 'FIESTA' (IZ*ONE Jo Yuri FanCam)│@SBS Inkigayo_2020.2.23`,
	`[입덕직캠] (여자)아이들 슈화 직캠 4K '덤디덤디(DUMDi DUMDi)' ((G)I-DLE SHUHUA FanCam) | @MCOUNTDOWN_2020.8.6`,
	`[MPD직캠] 아이즈원 안유진 직캠 4K '환상동화(Secret Story of the Swan)’(IZ*ONE An Yujin FanCam)|@MCOUNTDOWN_2020.7.2`,
	`[예능연구소] 에버글로우 이런 직캠 'LA DI DA' (EVERGLOW YIREN FanCam) @Show!MusicCore 200926`,
	`[K-Fancam] (여자)아이들 미연 '사랑해(Luv U)' ((G)I-DLE MIYEON Fancam) l @MusicBank 200501`,
	`[페이스캠4K] 아이즈원 미야와키 사쿠라 'FIESTA' (IZ*ONE Miyawaki Sakura Facecam)│@SBS Inkigayo_2020.3.1`,
	`191008 여자아이들 미연 직캠 4K 'Uh-Oh' (G)I-DLE Miyeon fancam @ 인제군 군장병 한마음 대회 by Spinel`,
];
var listed = list.map(i => ({item:i}));

var engine = elasticlunr(function() {
	this.setRef('item'); // required
	this.addField('item');
	this.saveDocument(false);
	this.pipeline.remove(elasticlunr.stemmer);
	this.pipeline.remove(elasticlunr.stopWordFilter);
	listed.forEach(i => this.addDoc(i));
});

keyword.forEach(word => {
	dump(word);
	let result = engine.search(word, {expand: true});
	let resulted = result.map(i => [i.score, i.ref]);
	resulted.forEach(i => dump(i));
});

list.forEach(item => {
	keyword.forEach(word => {
		/* ... */
	});
});