Search: Missing search data
Environment
- Operating System: Linux
- Node Version: v18.20.3
- Nuxt Version: 3.13.2
- CLI Version: 3.14.0
- Nitro Version: 2.9.7
- Package Manager: [email protected]
- Builder: -
- User Config: -
- Runtime Modules: -
- Build Modules: -
Reproduction
https://github.com/EmileSpecs/nuxtcontentsearch
Describe the bug
Using the playground minimal example I added all the necessary setup steps to get search to work.
I however het the error: Missing search data
Can't find any information about anyone having this issue and I don't see anything that I've missed configuring search.
Can someone please assist?
Thanks!
Additional context
No response
Logs
No response
This is because the await request will be executed once when the server renders, if you put it in the function will not happen Missing search data.
<script setup>
const search = ref("");
const results = ref([]);
const handleSearch = async () => {
results.value = await searchContent(search);
}
</script>
<template>
<main>
<input v-model="search" />
<button @click="handleSearch">search</button>
<pre>{{ results }} </pre>
</main>
</template>
However, he will have a strange warning that will ask you to replace 'searchContent' with '$fetch'
@sooooooooooooooooootheby thanks, that solved it.