Skip to content
Discussion options

You must be logged in to vote

Oh perfect, exactly what I was looking for. This works to import the index

const index = await fetch(import.meta.resolve("observablehq:minisearch.json")).
  then((response) => {
    if (!response.ok) throw new Error(`unable to load minisearch.json: ${response.status}`);
    return response.json();
  }).then((json) =>
    MiniSearch.loadJS(json, { fields: ['title', 'text', 'keyword'] }) 
    )

which I can then use as above. Thank you both!

Replies: 4 comments

This comment has been hidden.

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by kletts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants