Closed adaboese closed 5 months ago
it('finds the most similar URL entry', async () => { const searchIndex = await createSearchIndex('test'); await searchIndex.addItem('/', { original: '/', }); await searchIndex.addItem('/foo', { original: '/foo', }); await searchIndex.addItem('/bar', { original: '/bar', }); const result = await searchIndex.findNearestItem('/bar'); expect(result.item.metadata).toStrictEqual({ original: '/bar', }); });
In this example, score becomes NaN.
score
NaN
I worked around this by simply excluding / entries from the index, but it was a bizarre issue to debug.
/
Issue in my code.
In this example,
score
becomesNaN
.I worked around this by simply excluding
/
entries from the index, but it was a bizarre issue to debug.