[{"_path":"/getting-started/quick-start","_draft":false,"_partial":false,"_empty":false,"title":"Quick start","description":"","excerpt":{"type":"root","children":[{"type":"element","tag":"h2","props":{"id":"setup"},"children":[{"type":"text","value":"Setup"}]},{"type":"element","tag":"ol","props":{},"children":[{"type":"element","tag":"li","props":{},"children":[{"type":"element","tag":"strong","props":{},"children":[{"type":"text","value":"Install Algolia module"}]}]}]},{"type":"element","tag":"code-group","props":{},"children":[{"type":"element","tag":"code","props":{"code":"yarn add @nuxtjs/algolia\n","filename":"Yarn","language":"bash"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"text","value":"yarn add @nuxtjs/algolia\n"}]}]}]},{"type":"element","tag":"code","props":{"code":"npm install @nuxtjs/algolia --save\n","filename":"NPM","language":"bash"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"text","value":"npm install @nuxtjs/algolia --save\n"}]}]}]}]},{"type":"element","tag":"ol","props":{"start":2},"children":[{"type":"element","tag":"li","props":{},"children":[{"type":"element","tag":"strong","props":{},"children":[{"type":"text","value":"Enable the module in your Nuxt configuration"}]}]}]},{"type":"element","tag":"code","props":{"code":"export default defineNuxtConfig({\n  modules: ['@nuxtjs/algolia']\n})\n","filename":"nuxt.config.js","language":"js"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"text","value":"export default defineNuxtConfig({\n  modules: ['@nuxtjs/algolia']\n})\n"}]}]}]},{"type":"element","tag":"alert","props":{"type":"info"},"children":[{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"You can find more about configuring "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"@nuxtjs/algolia"}]},{"type":"text","value":" "},{"type":"element","tag":"a","props":{"href":"/getting-started/configuration"},"children":[{"type":"text","value":"here"}]},{"type":"text","value":"."}]}]},{"type":"element","tag":"ol","props":{"start":3},"children":[{"type":"element","tag":"li","props":{},"children":[{"type":"element","tag":"strong","props":{},"children":[{"type":"text","value":"Add "},{"type":"element","tag":"a","props":{"href":"https://www.algolia.com/doc/guides/security/api-keys/","rel":["nofollow","noopener","noreferrer"],"target":"_blank"},"children":[{"type":"text","value":"ALGOLIA_API_KEY"}]},{"type":"text","value":" and "},{"type":"element","tag":"a","props":{"href":"https://www.algolia.com/account/api-keys/","rel":["nofollow","noopener","noreferrer"],"target":"_blank"},"children":[{"type":"text","value":"ALGOLIA_APPLICATION_ID"}]},{"type":"text","value":" to the .env"}]}]}]},{"type":"element","tag":"code","props":{"code":"ALGOLIA_API_KEY=\"0fd1c4eba2d831788333e77c9d855f1d\"\nALGOLIA_APPLICATION_ID=\"AGN9HEEKF3\"\n","language":"env"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"text","value":"ALGOLIA_API_KEY=\"0fd1c4eba2d831788333e77c9d855f1d\"\nALGOLIA_APPLICATION_ID=\"AGN9HEEKF3\"\n"}]}]}]},{"type":"element","tag":"ol","props":{"start":4},"children":[{"type":"element","tag":"li","props":{},"children":[{"type":"element","tag":"strong","props":{},"children":[{"type":"text","value":"Use Algolia in your application"}]}]}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"Client side:"}]},{"type":"element","tag":"code","props":{"code":"<script setup lang=\"ts\">\nconst { result, search } = useAlgoliaSearch('test_index')\n\nonMounted(async () => {\n  await search({ query: 'Samsung' })\n})\n</script>\n\n<template>\n  <div>{{ result }}</div>\n</template>\n","language":"vue"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"text","value":"<script setup lang=\"ts\">\nconst { result, search } = useAlgoliaSearch('test_index')\n\nonMounted(async () => {\n  await search({ query: 'Samsung' })\n})\n</script>\n\n<template>\n  <div>{{ result }}</div>\n</template>\n"}]}]}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"Or SSR:"}]},{"type":"element","tag":"code","props":{"code":"<script setup lang=\"ts\">\nconst { data } = await useAsyncAlgoliaSearch({ indexName: 'test_index', query: 'Samsung' })\n</script>\n\n<template>\n  <div>{{ data }}</div>\n</template>\n","language":"vue"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"text","value":"<script setup lang=\"ts\">\nconst { data } = await useAsyncAlgoliaSearch({ indexName: 'test_index', query: 'Samsung' })\n</script>\n\n<template>\n  <div>{{ data }}</div>\n</template>\n"}]}]}]},{"type":"element","tag":"alert","props":{"type":"success"},"children":[{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"That's it! You can now use Algolia in your Nuxt app ✨"}]}]},{"type":"element","tag":"alert","props":{"type":"info"},"children":[{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"Check out "},{"type":"element","tag":"a","props":{"href":"/getting-started/usage","class":"text-primary-500"},"children":[{"type":"text","value":"how to use Algolia module further"}]},{"type":"text","value":"."}]}]}]},"body":{"type":"root","children":[{"type":"element","tag":"h2","props":{"id":"setup"},"children":[{"type":"text","value":"Setup"}]},{"type":"element","tag":"ol","props":{},"children":[{"type":"element","tag":"li","props":{},"children":[{"type":"element","tag":"strong","props":{},"children":[{"type":"text","value":"Install Algolia module"}]}]}]},{"type":"element","tag":"code-group","props":{},"children":[{"type":"element","tag":"code","props":{"code":"yarn add @nuxtjs/algolia\n","filename":"Yarn","language":"bash"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"class":"ct-f23ef0"},"children":[{"type":"text","value":"yarn add @nuxtjs/algolia"}]}]}]}]}]},{"type":"element","tag":"code","props":{"code":"npm install @nuxtjs/algolia --save\n","filename":"NPM","language":"bash"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"class":"ct-f23ef0"},"children":[{"type":"text","value":"npm install @nuxtjs/algolia --save"}]}]}]}]}]}]},{"type":"element","tag":"ol","props":{"start":2},"children":[{"type":"element","tag":"li","props":{},"children":[{"type":"element","tag":"strong","props":{},"children":[{"type":"text","value":"Enable the module in your Nuxt configuration"}]}]}]},{"type":"element","tag":"code","props":{"code":"export default defineNuxtConfig({\n  modules: ['@nuxtjs/algolia']\n})\n","filename":"nuxt.config.js","language":"js"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"class":"ct-1f2698"},"children":[{"type":"text","value":"export"}]},{"type":"element","tag":"span","props":{"class":"ct-f23ef0"},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"class":"ct-1f2698"},"children":[{"type":"text","value":"default"}]},{"type":"element","tag":"span","props":{"class":"ct-f23ef0"},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"class":"ct-73ccdc"},"children":[{"type":"text","value":"defineNuxtConfig"}]},{"type":"element","tag":"span","props":{"class":"ct-f23ef0"},"children":[{"type":"text","value":"({"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"class":"ct-f23ef0"},"children":[{"type":"text","value":"  "}]},{"type":"element","tag":"span","props":{"class":"ct-87de4d"},"children":[{"type":"text","value":"modules"}]},{"type":"element","tag":"span","props":{"class":"ct-f23ef0"},"children":[{"type":"text","value":": ["}]},{"type":"element","tag":"span","props":{"class":"ct-099271"},"children":[{"type":"text","value":"'@nuxtjs/algolia'"}]},{"type":"element","tag":"span","props":{"class":"ct-f23ef0"},"children":[{"type":"text","value":"]"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"class":"ct-f23ef0"},"children":[{"type":"text","value":"})"}]}]}]}]}]},{"type":"element","tag":"alert","props":{"type":"info"},"children":[{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"You can find more about configuring "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"@nuxtjs/algolia"}]},{"type":"text","value":" "},{"type":"element","tag":"a","props":{"href":"/getting-started/configuration"},"children":[{"type":"text","value":"here"}]},{"type":"text","value":"."}]}]},{"type":"element","tag":"ol","props":{"start":3},"children":[{"type":"element","tag":"li","props":{},"children":[{"type":"element","tag":"strong","props":{},"children":[{"type":"text","value":"Add "},{"type":"element","tag":"a","props":{"href":"https://www.algolia.com/doc/guides/security/api-keys/","rel":["nofollow","noopener","noreferrer"],"target":"_blank"},"children":[{"type":"text","value":"ALGOLIA_API_KEY"}]},{"type":"text","value":" and "},{"type":"element","tag":"a","props":{"href":"https://www.algolia.com/account/api-keys/","rel":["nofollow","noopener","noreferrer"],"target":"_blank"},"children":[{"type":"text","value":"ALGOLIA_APPLICATION_ID"}]},{"type":"text","value":" to the .env"}]}]}]},{"type":"element","tag":"code","props":{"code":"ALGOLIA_API_KEY=\"0fd1c4eba2d831788333e77c9d855f1d\"\nALGOLIA_APPLICATION_ID=\"AGN9HEEKF3\"\n","language":"env"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{},"children":[{"type":"text","value":"ALGOLIA_API_KEY=\"0fd1c4eba2d831788333e77c9d855f1d\"\nALGOLIA_APPLICATION_ID=\"AGN9HEEKF3\""}]}]}]}]}]},{"type":"element","tag":"ol","props":{"start":4},"children":[{"type":"element","tag":"li","props":{},"children":[{"type":"element","tag":"strong","props":{},"children":[{"type":"text","value":"Use Algolia in your application"}]}]}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"Client side:"}]},{"type":"element","tag":"code","props":{"code":"<script setup lang=\"ts\">\nconst { result, search } = useAlgoliaSearch('test_index')\n\nonMounted(async () => {\n  await search({ query: 'Samsung' })\n})\n</script>\n\n<template>\n  <div>{{ result }}</div>\n</template>\n","language":"vue"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"class":"ct-f23ef0"},"children":[{"type":"text","value":"<"}]},{"type":"element","tag":"span","props":{"class":"ct-87de4d"},"children":[{"type":"text","value":"script"}]},{"type":"element","tag":"span","props":{"class":"ct-f23ef0"},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"class":"ct-f293d2"},"children":[{"type":"text","value":"setup"}]},{"type":"element","tag":"span","props":{"class":"ct-f23ef0"},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"class":"ct-f293d2"},"children":[{"type":"text","value":"lang"}]},{"type":"element","tag":"span","props":{"class":"ct-f23ef0"},"children":[{"type":"text","value":"="}]},{"type":"element","tag":"span","props":{"class":"ct-099271"},"children":[{"type":"text","value":"\"ts\""}]},{"type":"element","tag":"span","props":{"class":"ct-f23ef0"},"children":[{"type":"text","value":">"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"class":"ct-1f2698"},"children":[{"type":"text","value":"const"}]},{"type":"element","tag":"span","props":{"class":"ct-f23ef0"},"children":[{"type":"text","value":" { "}]},{"type":"element","tag":"span","props":{"class":"ct-af4e38"},"children":[{"type":"text","value":"result"}]},{"type":"element","tag":"span","props":{"class":"ct-f23ef0"},"children":[{"type":"text","value":", "}]},{"type":"element","tag":"span","props":{"class":"ct-af4e38"},"children":[{"type":"text","value":"search"}]},{"type":"element","tag":"span","props":{"class":"ct-f23ef0"},"children":[{"type":"text","value":" } "}]},{"type":"element","tag":"span","props":{"class":"ct-ec0569"},"children":[{"type":"text","value":"="}]},{"type":"element","tag":"span","props":{"class":"ct-f23ef0"},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"class":"ct-73ccdc"},"children":[{"type":"text","value":"useAlgoliaSearch"}]},{"type":"element","tag":"span","props":{"class":"ct-f23ef0"},"children":[{"type":"text","value":"("}]},{"type":"element","tag":"span","props":{"class":"ct-099271"},"children":[{"type":"text","value":"'test_index'"}]},{"type":"element","tag":"span","props":{"class":"ct-f23ef0"},"children":[{"type":"text","value":")"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"class":"ct-73ccdc"},"children":[{"type":"text","value":"onMounted"}]},{"type":"element","tag":"span","props":{"class":"ct-f23ef0"},"children":[{"type":"text","value":"("}]},{"type":"element","tag":"span","props":{"class":"ct-1f2698"},"children":[{"type":"text","value":"async"}]},{"type":"element","tag":"span","props":{"class":"ct-f23ef0"},"children":[{"type":"text","value":" () "}]},{"type":"element","tag":"span","props":{"class":"ct-1f2698"},"children":[{"type":"text","value":"=>"}]},{"type":"element","tag":"span","props":{"class":"ct-f23ef0"},"children":[{"type":"text","value":" {"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"class":"ct-f23ef0"},"children":[{"type":"text","value":"  "}]},{"type":"element","tag":"span","props":{"class":"ct-1f2698"},"children":[{"type":"text","value":"await"}]},{"type":"element","tag":"span","props":{"class":"ct-f23ef0"},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"class":"ct-73ccdc"},"children":[{"type":"text","value":"search"}]},{"type":"element","tag":"span","props":{"class":"ct-f23ef0"},"children":[{"type":"text","value":"({ "}]},{"type":"element","tag":"span","props":{"class":"ct-87de4d"},"children":[{"type":"text","value":"query"}]},{"type":"element","tag":"span","props":{"class":"ct-f23ef0"},"children":[{"type":"text","value":": "}]},{"type":"element","tag":"span","props":{"class":"ct-099271"},"children":[{"type":"text","value":"'Samsung'"}]},{"type":"element","tag":"span","props":{"class":"ct-f23ef0"},"children":[{"type":"text","value":" })"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"class":"ct-f23ef0"},"children":[{"type":"text","value":"})"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"class":"ct-f23ef0"},"children":[{"type":"text","value":"</"}]},{"type":"element","tag":"span","props":{"class":"ct-87de4d"},"children":[{"type":"text","value":"script"}]},{"type":"element","tag":"span","props":{"class":"ct-f23ef0"},"children":[{"type":"text","value":">"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"class":"ct-f23ef0"},"children":[{"type":"text","value":"<"}]},{"type":"element","tag":"span","props":{"class":"ct-87de4d"},"children":[{"type":"text","value":"template"}]},{"type":"element","tag":"span","props":{"class":"ct-f23ef0"},"children":[{"type":"text","value":">"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"class":"ct-f23ef0"},"children":[{"type":"text","value":"  <"}]},{"type":"element","tag":"span","props":{"class":"ct-f293d2"},"children":[{"type":"text","value":"div"}]},{"type":"element","tag":"span","props":{"class":"ct-f23ef0"},"children":[{"type":"text","value":">{{ "}]},{"type":"element","tag":"span","props":{"class":"ct-f293d2"},"children":[{"type":"text","value":"result"}]},{"type":"element","tag":"span","props":{"class":"ct-f23ef0"},"children":[{"type":"text","value":" }}</"}]},{"type":"element","tag":"span","props":{"class":"ct-f293d2"},"children":[{"type":"text","value":"div"}]},{"type":"element","tag":"span","props":{"class":"ct-f23ef0"},"children":[{"type":"text","value":">"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"class":"ct-f23ef0"},"children":[{"type":"text","value":"</"}]},{"type":"element","tag":"span","props":{"class":"ct-87de4d"},"children":[{"type":"text","value":"template"}]},{"type":"element","tag":"span","props":{"class":"ct-f23ef0"},"children":[{"type":"text","value":">"}]}]}]}]}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"Or SSR:"}]},{"type":"element","tag":"code","props":{"code":"<script setup lang=\"ts\">\nconst { data } = await useAsyncAlgoliaSearch({ indexName: 'test_index', query: 'Samsung' })\n</script>\n\n<template>\n  <div>{{ data }}</div>\n</template>\n","language":"vue"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"class":"ct-f23ef0"},"children":[{"type":"text","value":"<"}]},{"type":"element","tag":"span","props":{"class":"ct-87de4d"},"children":[{"type":"text","value":"script"}]},{"type":"element","tag":"span","props":{"class":"ct-f23ef0"},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"class":"ct-f293d2"},"children":[{"type":"text","value":"setup"}]},{"type":"element","tag":"span","props":{"class":"ct-f23ef0"},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"class":"ct-f293d2"},"children":[{"type":"text","value":"lang"}]},{"type":"element","tag":"span","props":{"class":"ct-f23ef0"},"children":[{"type":"text","value":"="}]},{"type":"element","tag":"span","props":{"class":"ct-099271"},"children":[{"type":"text","value":"\"ts\""}]},{"type":"element","tag":"span","props":{"class":"ct-f23ef0"},"children":[{"type":"text","value":">"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"class":"ct-1f2698"},"children":[{"type":"text","value":"const"}]},{"type":"element","tag":"span","props":{"class":"ct-f23ef0"},"children":[{"type":"text","value":" { "}]},{"type":"element","tag":"span","props":{"class":"ct-af4e38"},"children":[{"type":"text","value":"data"}]},{"type":"element","tag":"span","props":{"class":"ct-f23ef0"},"children":[{"type":"text","value":" } "}]},{"type":"element","tag":"span","props":{"class":"ct-ec0569"},"children":[{"type":"text","value":"="}]},{"type":"element","tag":"span","props":{"class":"ct-f23ef0"},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"class":"ct-1f2698"},"children":[{"type":"text","value":"await"}]},{"type":"element","tag":"span","props":{"class":"ct-f23ef0"},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"class":"ct-73ccdc"},"children":[{"type":"text","value":"useAsyncAlgoliaSearch"}]},{"type":"element","tag":"span","props":{"class":"ct-f23ef0"},"children":[{"type":"text","value":"({ "}]},{"type":"element","tag":"span","props":{"class":"ct-87de4d"},"children":[{"type":"text","value":"indexName"}]},{"type":"element","tag":"span","props":{"class":"ct-f23ef0"},"children":[{"type":"text","value":": "}]},{"type":"element","tag":"span","props":{"class":"ct-099271"},"children":[{"type":"text","value":"'test_index'"}]},{"type":"element","tag":"span","props":{"class":"ct-f23ef0"},"children":[{"type":"text","value":", "}]},{"type":"element","tag":"span","props":{"class":"ct-87de4d"},"children":[{"type":"text","value":"query"}]},{"type":"element","tag":"span","props":{"class":"ct-f23ef0"},"children":[{"type":"text","value":": "}]},{"type":"element","tag":"span","props":{"class":"ct-099271"},"children":[{"type":"text","value":"'Samsung'"}]},{"type":"element","tag":"span","props":{"class":"ct-f23ef0"},"children":[{"type":"text","value":" })"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"class":"ct-f23ef0"},"children":[{"type":"text","value":"</"}]},{"type":"element","tag":"span","props":{"class":"ct-87de4d"},"children":[{"type":"text","value":"script"}]},{"type":"element","tag":"span","props":{"class":"ct-f23ef0"},"children":[{"type":"text","value":">"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"class":"ct-f23ef0"},"children":[{"type":"text","value":"<"}]},{"type":"element","tag":"span","props":{"class":"ct-87de4d"},"children":[{"type":"text","value":"template"}]},{"type":"element","tag":"span","props":{"class":"ct-f23ef0"},"children":[{"type":"text","value":">"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"class":"ct-f23ef0"},"children":[{"type":"text","value":"  <"}]},{"type":"element","tag":"span","props":{"class":"ct-f293d2"},"children":[{"type":"text","value":"div"}]},{"type":"element","tag":"span","props":{"class":"ct-f23ef0"},"children":[{"type":"text","value":">{{ "}]},{"type":"element","tag":"span","props":{"class":"ct-f293d2"},"children":[{"type":"text","value":"data"}]},{"type":"element","tag":"span","props":{"class":"ct-f23ef0"},"children":[{"type":"text","value":" }}</"}]},{"type":"element","tag":"span","props":{"class":"ct-f293d2"},"children":[{"type":"text","value":"div"}]},{"type":"element","tag":"span","props":{"class":"ct-f23ef0"},"children":[{"type":"text","value":">"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"class":"ct-f23ef0"},"children":[{"type":"text","value":"</"}]},{"type":"element","tag":"span","props":{"class":"ct-87de4d"},"children":[{"type":"text","value":"template"}]},{"type":"element","tag":"span","props":{"class":"ct-f23ef0"},"children":[{"type":"text","value":">"}]}]}]}]}]},{"type":"element","tag":"alert","props":{"type":"success"},"children":[{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"That's it! You can now use Algolia in your Nuxt app ✨"}]}]},{"type":"element","tag":"alert","props":{"type":"info"},"children":[{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"Check out "},{"type":"element","tag":"a","props":{"href":"/getting-started/usage","class":"text-primary-500"},"children":[{"type":"text","value":"how to use Algolia module further"}]},{"type":"text","value":"."}]}]},{"type":"element","tag":"style","children":[{"type":"text","value":".ct-ec0569{color:#56B6C2}.ct-af4e38{color:#E5C07B}.ct-f293d2{color:#D19A66}.ct-099271{color:#98C379}.ct-87de4d{color:#E06C75}.ct-73ccdc{color:#61AFEF}.ct-1f2698{color:#C678DD}.ct-f23ef0{color:#ABB2BF}"}]}],"toc":{"title":"","searchDepth":2,"depth":2,"links":[{"id":"setup","depth":2,"text":"Setup"}]}},"_type":"markdown","_id":"content:1.getting-started:1.quick-start.md","_source":"content","_file":"1.getting-started/1.quick-start.md","_extension":"md"},{"_path":"/getting-started/usage","_draft":false,"_partial":false,"_empty":false,"title":"Usage","description":"","excerpt":{"type":"root","children":[{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"This module exposes composables that are "},{"type":"element","tag":"a","props":{"href":"https://nuxt.com/docs/guide/directory-structure/composables#composables-directory","rel":["nofollow","noopener","noreferrer"],"target":"_blank"},"children":[{"type":"text","value":"auto-imported"}]},{"type":"text","value":" by Nuxt 3."}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"For more details check out the official documentation of initializing algolia client "},{"type":"element","tag":"a","props":{"href":"https://www.algolia.com/doc/api-client/getting-started/instantiate-client-index/javascript/?client=javascript","rel":["nofollow","noopener","noreferrer"],"target":"_blank"},"children":[{"type":"text","value":"here"}]}]},{"type":"element","tag":"h2","props":{"id":"usealgoliasearch"},"children":[{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"useAlgoliaSearch"}]}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"Use this composable to search the index by certain query and optional request options"}]},{"type":"element","tag":"code","props":{"code":"<script setup>\nconst { result, search } = useAlgoliaSearch('test_index') // pass your index name as param\n\nonMounted(async () => {\n  await search({ query: 'Samsung' });\n})\n</script>\n","language":"vue"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"text","value":"<script setup>\nconst { result, search } = useAlgoliaSearch('test_index') // pass your index name as param\n\nonMounted(async () => {\n  await search({ query: 'Samsung' });\n})\n</script>\n"}]}]}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"This composable works also for SSR applications and requests like this:"}]},{"type":"element","tag":"code","props":{"code":"<script setup lang=\"ts\">\nconst { result, search } = useAlgoliaSearch('test_index') // pass your index name as param\n\nconst { data } = await useAsyncData('ssr-search-results', () => search({ query: 'Samsung' }))\n</script>\n","language":"vue"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"text","value":"<script setup lang=\"ts\">\nconst { result, search } = useAlgoliaSearch('test_index') // pass your index name as param\n\nconst { data } = await useAsyncData('ssr-search-results', () => search({ query: 'Samsung' }))\n</script>\n"}]}]}]},{"type":"element","tag":"ul","props":{},"children":[{"type":"element","tag":"li","props":{},"children":[{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"result"}]},{"type":"text","value":" will contain a value of a search method. It is reactive computed property that will be populated when a search method will fulfill. This result will have a form described "},{"type":"element","tag":"a","props":{"href":"https://www.algolia.com/doc/api-reference/api-methods/search/#response","rel":["nofollow","noopener","noreferrer"],"target":"_blank"},"children":[{"type":"text","value":"here"}]}]},{"type":"element","tag":"li","props":{},"children":[{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"search"}]},{"type":"text","value":" method is used to fetch the results by the index and populates "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"result"}]},{"type":"text","value":" reactive property. This method requires a parameter "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"query"}]},{"type":"text","value":" and accepts an optional parameter of "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"requestOptions"}]},{"type":"text","value":" that you can check out "},{"type":"element","tag":"a","props":{"href":"https://www.algolia.com/doc/api-reference/api-methods/search/#method-param-requestoptions","rel":["nofollow","noopener","noreferrer"],"target":"_blank"},"children":[{"type":"text","value":"here"}]}]}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"For more details check out the official documentation of this method "},{"type":"element","tag":"a","props":{"href":"https://www.algolia.com/doc/api-client/methods/search/","rel":["nofollow","noopener","noreferrer"],"target":"_blank"},"children":[{"type":"text","value":"here"}]}]},{"type":"element","tag":"h2","props":{"id":"useasyncalgoliasearch"},"children":[{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"useAsyncAlgoliaSearch"}]}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"Async wrapper around "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"useAlgoliaSearch"}]},{"type":"text","value":" composable that decreases the number of steps needed to use Algolia with "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"useAsyncData"}]},{"type":"text","value":" while maintaining the same functionality. The response will have a form described "},{"type":"element","tag":"a","props":{"href":"https://www.algolia.com/doc/api-reference/api-methods/search/#response","rel":["nofollow","noopener","noreferrer"],"target":"_blank"},"children":[{"type":"text","value":"here"}]},{"type":"text","value":" and will be wrapped around "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"useAsyncData"}]},{"type":"text","value":" so you will have access to "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"data"}]},{"type":"text","value":", "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"error"}]},{"type":"text","value":", and other properties."}]},{"type":"element","tag":"code","props":{"code":"<script setup lang=\"ts\">\nconst { data, error } = await useAsyncAlgoliaSearch({ indexName: 'test_index', query: 'Samsung' })\n</script>\n\n<template>\n  <div>{{ data.value.hits }}</div>\n</template>\n","language":"vue"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"text","value":"<script setup lang=\"ts\">\nconst { data, error } = await useAsyncAlgoliaSearch({ indexName: 'test_index', query: 'Samsung' })\n</script>\n\n<template>\n  <div>{{ data.value.hits }}</div>\n</template>\n"}]}]}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"This composable accepts an object as a param with following properties:"}]},{"type":"element","tag":"ul","props":{},"children":[{"type":"element","tag":"li","props":{},"children":[{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"indexName"}]},{"type":"text","value":" - the name of you index in Algolia dashboard. For more details about initializing index check out the official documentation "},{"type":"element","tag":"a","props":{"href":"https://www.algolia.com/doc/api-client/getting-started/instantiate-client-index/javascript/?client=javascript#initialize-an-index","rel":["nofollow","noopener","noreferrer"],"target":"_blank"},"children":[{"type":"text","value":"here"}]},{"type":"text","value":". If you passed a global index in your module configuration, this property can be skipped."}]},{"type":"element","tag":"li","props":{},"children":[{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"query"}]},{"type":"text","value":" - a keyword, sentence, or text that you want to search the index with."}]},{"type":"element","tag":"li","props":{},"children":[{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"key"}]},{"type":"text","value":" - if you need multiple asyncAlgoliaSearch calls in a single page, add a unique key to get passed to the useAsyncData underneath, so new calls won't overwrite old data."}]},{"type":"element","tag":"li","props":{},"children":[{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"requestOptions"}]},{"type":"text","value":" optional object with options for the request like filters. You can check more about is "},{"type":"element","tag":"a","props":{"href":"https://www.algolia.com/doc/api-reference/api-methods/search/#method-param-requestoptions","rel":["nofollow","noopener","noreferrer"],"target":"_blank"},"children":[{"type":"text","value":"here"}]}]}]},{"type":"element","tag":"h2","props":{"id":"usealgoliafacetedsearch"},"children":[{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"useAlgoliaFacetedSearch"}]}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"Use this composable to search using facet values like "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"category"}]},{"type":"text","value":", "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"phone"}]},{"type":"text","value":"."}]},{"type":"element","tag":"alert","props":{"type":"info"},"children":[{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"In order for this to work, you have to add facet attributes in your dashboard or via code. Read more about it "},{"type":"element","tag":"a","props":{"href":"https://www.algolia.com/doc/guides/managing-results/refine-results/faceting/","rel":["nofollow","noopener","noreferrer"],"target":"_blank"},"children":[{"type":"text","value":"here"}]}]}]},{"type":"element","tag":"code","props":{"code":"<script setup>\nconst { result, search } = useAlgoliaFacetedSearch('test_index')\n\nonMounted(async () => {\n  const facet = { \n    name: 'category',\n    query: 'phone'\n   }\n  await search({ facet })\n})\n</script>\n","language":"vue"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"text","value":"<script setup>\nconst { result, search } = useAlgoliaFacetedSearch('test_index')\n\nonMounted(async () => {\n  const facet = { \n    name: 'category',\n    query: 'phone'\n   }\n  await search({ facet })\n})\n</script>\n"}]}]}]},{"type":"element","tag":"ul","props":{},"children":[{"type":"element","tag":"li","props":{},"children":[{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"result"}]},{"type":"text","value":" will contain a value of a search method. It is reactive computed property that will be populated when a search method will fulfill. This result will have a form described "},{"type":"element","tag":"a","props":{"href":"https://www.algolia.com/doc/api-reference/api-methods/search-for-facet-values/#response","rel":["nofollow","noopener","noreferrer"],"target":"_blank"},"children":[{"type":"text","value":"here"}]}]},{"type":"element","tag":"li","props":{},"children":[{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"search"}]},{"type":"text","value":" method is used to fetch the results by the certain facet value pairs like name and query, and populates "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"result"}]},{"type":"text","value":" reactive property. This method requries a parameter for "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"facet"}]},{"type":"text","value":" and accepts an optional parameter of "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"requestOptions"}]},{"type":"text","value":" that you can check out "},{"type":"element","tag":"a","props":{"href":"https://www.algolia.com/doc/api-reference/api-methods/search/#method-param-requestoptions","rel":["nofollow","noopener","noreferrer"],"target":"_blank"},"children":[{"type":"text","value":"here"}]}]}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"For more details about using this search method check out the official documentation "},{"type":"element","tag":"a","props":{"href":"https://www.algolia.com/doc/api-reference/api-methods/search-for-facet-values/","rel":["nofollow","noopener","noreferrer"],"target":"_blank"},"children":[{"type":"text","value":"here"}]}]},{"type":"element","tag":"h2","props":{"id":"usealgoliarecommend"},"children":[{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"useAlgoliaRecommend"}]}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"Use this composable to get the recommendations matching certain criteria optional request options."}]},{"type":"element","tag":"alert","props":{"type":"info"},"children":[{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"In order to make this composable work, make sure to setup a "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"recommend"}]},{"type":"text","value":" property to "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"true"}]},{"type":"text","value":" in algolia configuration in "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"nuxt.config.ts"}]},{"type":"text","value":"."}]}]},{"type":"element","tag":"code","props":{"code":"<script setup>\nconst { result, get } = useAlgoliaRecommend()\n\nonMounted(async () => {\n  await get({ queries: [{ indexName: 'test_index', model: 'related-products', objectID: 'dca44dd5-aea6-4553-a3af-fcbda981a2ef' }] });\n})\n</script>\n","language":"vue"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"text","value":"<script setup>\nconst { result, get } = useAlgoliaRecommend()\n\nonMounted(async () => {\n  await get({ queries: [{ indexName: 'test_index', model: 'related-products', objectID: 'dca44dd5-aea6-4553-a3af-fcbda981a2ef' }] });\n})\n</script>\n"}]}]}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"This composable returns the following:"}]},{"type":"element","tag":"ul","props":{},"children":[{"type":"element","tag":"li","props":{},"children":[{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"result"}]},{"type":"text","value":" will contain a value of a get method. It is reactive computed property that will be populated when a get method will fulfill. This result will have a form described "},{"type":"element","tag":"a","props":{"href":"https://www.algolia.com/doc/api-reference/api-methods/get-recommendations/#response","rel":["nofollow","noopener","noreferrer"],"target":"_blank"},"children":[{"type":"text","value":"here"}]}]},{"type":"element","tag":"li","props":{},"children":[{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"get"}]},{"type":"text","value":" method is used to get the recommendations based on the criteria described "},{"type":"element","tag":"a","props":{"href":"https://www.algolia.com/doc/api-reference/api-methods/get-recommendations/#parameters","rel":["nofollow","noopener","noreferrer"],"target":"_blank"},"children":[{"type":"text","value":"here"}]},{"type":"text","value":" and an optional parameter of "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"requestOptions"}]},{"type":"text","value":" that you can check out "},{"type":"element","tag":"a","props":{"href":"https://www.algolia.com/doc/api-reference/api-methods/search/#method-param-requestoptions","rel":["nofollow","noopener","noreferrer"],"target":"_blank"},"children":[{"type":"text","value":"here"}]}]}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"This composable also accepts an optional key parameter:"}]},{"type":"element","tag":"ul","props":{},"children":[{"type":"element","tag":"li","props":{},"children":[{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"key"}]},{"type":"text","value":" - if you need multiple useAlgoliaRecommend calls, add a unique key to get passed to the userState('recommend-result') underneath, so new calls won't overwrite old data."}]}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"For more details check out the official documentation of this method "},{"type":"element","tag":"a","props":{"href":"https://www.algolia.com/doc/api-reference/api-methods/get-recommendations/","rel":["nofollow","noopener","noreferrer"],"target":"_blank"},"children":[{"type":"text","value":"here"}]}]},{"type":"element","tag":"h2","props":{"id":"usealgoliaref"},"children":[{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"useAlgoliaRef"}]}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"By calling this composable you have access to "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"algoliasearch"}]},{"type":"text","value":" instance anywhere in your app"}]},{"type":"element","tag":"code","props":{"code":"<script setup>\nconst algolia = useAlgoliaRef()\n</script>\n","language":"vue"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"text","value":"<script setup>\nconst algolia = useAlgoliaRef()\n</script>\n"}]}]}]},{"type":"element","tag":"h2","props":{"id":"usealgoliainitindex"},"children":[{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"useAlgoliaInitIndex"}]}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"Use this composable to initialize index you would like to search through. It accepts an index name as a parameter"}]},{"type":"element","tag":"code","props":{"code":"<script setup>\nconst algoliaIndex = useAlgoliaInitIndex('test')\n\nconsole.log(algoliaIndex.appId)\n</script>\n","language":"vue"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"text","value":"<script setup>\nconst algoliaIndex = useAlgoliaInitIndex('test')\n\nconsole.log(algoliaIndex.appId)\n</script>\n"}]}]}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"For more details about initializing index check out the official documentation "},{"type":"element","tag":"a","props":{"href":"https://www.algolia.com/doc/api-client/getting-started/instantiate-client-index/javascript/?client=javascript#initialize-an-index","rel":["nofollow","noopener","noreferrer"],"target":"_blank"},"children":[{"type":"text","value":"here"}]}]}]},"body":{"type":"root","children":[{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"This module exposes composables that are "},{"type":"element","tag":"a","props":{"href":"https://nuxt.com/docs/guide/directory-structure/composables#composables-directory","rel":["nofollow","noopener","noreferrer"],"target":"_blank"},"children":[{"type":"text","value":"auto-imported"}]},{"type":"text","value":" by Nuxt 3."}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"For more details check out the official documentation of initializing algolia client "},{"type":"element","tag":"a","props":{"href":"https://www.algolia.com/doc/api-client/getting-started/instantiate-client-index/javascript/?client=javascript","rel":["nofollow","noopener","noreferrer"],"target":"_blank"},"children":[{"type":"text","value":"here"}]}]},{"type":"element","tag":"h2","props":{"id":"usealgoliasearch"},"children":[{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"useAlgoliaSearch"}]}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"Use this composable to search the index by certain query and optional request options"}]},{"type":"element","tag":"code","props":{"code":"<script setup>\nconst { result, search } = useAlgoliaSearch('test_index') // pass your index name as param\n\nonMounted(async () => {\n  await search({ query: 'Samsung' });\n})\n</script>\n","language":"vue"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"class":"ct-dcad69"},"children":[{"type":"text","value":"<"}]},{"type":"element","tag":"span","props":{"class":"ct-87b207"},"children":[{"type":"text","value":"script"}]},{"type":"element","tag":"span","props":{"class":"ct-dcad69"},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"class":"ct-4770c2"},"children":[{"type":"text","value":"setup"}]},{"type":"element","tag":"span","props":{"class":"ct-dcad69"},"children":[{"type":"text","value":">"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"class":"ct-54935f"},"children":[{"type":"text","value":"const"}]},{"type":"element","tag":"span","props":{"class":"ct-dcad69"},"children":[{"type":"text","value":" { "}]},{"type":"element","tag":"span","props":{"class":"ct-f52cf9"},"children":[{"type":"text","value":"result"}]},{"type":"element","tag":"span","props":{"class":"ct-dcad69"},"children":[{"type":"text","value":", "}]},{"type":"element","tag":"span","props":{"class":"ct-f52cf9"},"children":[{"type":"text","value":"search"}]},{"type":"element","tag":"span","props":{"class":"ct-dcad69"},"children":[{"type":"text","value":" } "}]},{"type":"element","tag":"span","props":{"class":"ct-10533f"},"children":[{"type":"text","value":"="}]},{"type":"element","tag":"span","props":{"class":"ct-dcad69"},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"class":"ct-861b72"},"children":[{"type":"text","value":"useAlgoliaSearch"}]},{"type":"element","tag":"span","props":{"class":"ct-dcad69"},"children":[{"type":"text","value":"("}]},{"type":"element","tag":"span","props":{"class":"ct-23564f"},"children":[{"type":"text","value":"'test_index'"}]},{"type":"element","tag":"span","props":{"class":"ct-dcad69"},"children":[{"type":"text","value":") "}]},{"type":"element","tag":"span","props":{"class":"ct-0cb029"},"children":[{"type":"text","value":"// pass your index name as param"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"class":"ct-861b72"},"children":[{"type":"text","value":"onMounted"}]},{"type":"element","tag":"span","props":{"class":"ct-dcad69"},"children":[{"type":"text","value":"("}]},{"type":"element","tag":"span","props":{"class":"ct-54935f"},"children":[{"type":"text","value":"async"}]},{"type":"element","tag":"span","props":{"class":"ct-dcad69"},"children":[{"type":"text","value":" () "}]},{"type":"element","tag":"span","props":{"class":"ct-54935f"},"children":[{"type":"text","value":"=>"}]},{"type":"element","tag":"span","props":{"class":"ct-dcad69"},"children":[{"type":"text","value":" {"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"class":"ct-dcad69"},"children":[{"type":"text","value":"  "}]},{"type":"element","tag":"span","props":{"class":"ct-54935f"},"children":[{"type":"text","value":"await"}]},{"type":"element","tag":"span","props":{"class":"ct-dcad69"},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"class":"ct-861b72"},"children":[{"type":"text","value":"search"}]},{"type":"element","tag":"span","props":{"class":"ct-dcad69"},"children":[{"type":"text","value":"({ "}]},{"type":"element","tag":"span","props":{"class":"ct-87b207"},"children":[{"type":"text","value":"query"}]},{"type":"element","tag":"span","props":{"class":"ct-dcad69"},"children":[{"type":"text","value":": "}]},{"type":"element","tag":"span","props":{"class":"ct-23564f"},"children":[{"type":"text","value":"'Samsung'"}]},{"type":"element","tag":"span","props":{"class":"ct-dcad69"},"children":[{"type":"text","value":" });"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"class":"ct-dcad69"},"children":[{"type":"text","value":"})"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"class":"ct-dcad69"},"children":[{"type":"text","value":"</"}]},{"type":"element","tag":"span","props":{"class":"ct-87b207"},"children":[{"type":"text","value":"script"}]},{"type":"element","tag":"span","props":{"class":"ct-dcad69"},"children":[{"type":"text","value":">"}]}]}]}]}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"This composable works also for SSR applications and requests like this:"}]},{"type":"element","tag":"code","props":{"code":"<script setup lang=\"ts\">\nconst { result, search } = useAlgoliaSearch('test_index') // pass your index name as param\n\nconst { data } = await useAsyncData('ssr-search-results', () => search({ query: 'Samsung' }))\n</script>\n","language":"vue"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"class":"ct-dcad69"},"children":[{"type":"text","value":"<"}]},{"type":"element","tag":"span","props":{"class":"ct-87b207"},"children":[{"type":"text","value":"script"}]},{"type":"element","tag":"span","props":{"class":"ct-dcad69"},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"class":"ct-4770c2"},"children":[{"type":"text","value":"setup"}]},{"type":"element","tag":"span","props":{"class":"ct-dcad69"},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"class":"ct-4770c2"},"children":[{"type":"text","value":"lang"}]},{"type":"element","tag":"span","props":{"class":"ct-dcad69"},"children":[{"type":"text","value":"="}]},{"type":"element","tag":"span","props":{"class":"ct-23564f"},"children":[{"type":"text","value":"\"ts\""}]},{"type":"element","tag":"span","props":{"class":"ct-dcad69"},"children":[{"type":"text","value":">"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"class":"ct-54935f"},"children":[{"type":"text","value":"const"}]},{"type":"element","tag":"span","props":{"class":"ct-dcad69"},"children":[{"type":"text","value":" { "}]},{"type":"element","tag":"span","props":{"class":"ct-f52cf9"},"children":[{"type":"text","value":"result"}]},{"type":"element","tag":"span","props":{"class":"ct-dcad69"},"children":[{"type":"text","value":", "}]},{"type":"element","tag":"span","props":{"class":"ct-f52cf9"},"children":[{"type":"text","value":"search"}]},{"type":"element","tag":"span","props":{"class":"ct-dcad69"},"children":[{"type":"text","value":" } "}]},{"type":"element","tag":"span","props":{"class":"ct-10533f"},"children":[{"type":"text","value":"="}]},{"type":"element","tag":"span","props":{"class":"ct-dcad69"},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"class":"ct-861b72"},"children":[{"type":"text","value":"useAlgoliaSearch"}]},{"type":"element","tag":"span","props":{"class":"ct-dcad69"},"children":[{"type":"text","value":"("}]},{"type":"element","tag":"span","props":{"class":"ct-23564f"},"children":[{"type":"text","value":"'test_index'"}]},{"type":"element","tag":"span","props":{"class":"ct-dcad69"},"children":[{"type":"text","value":") "}]},{"type":"element","tag":"span","props":{"class":"ct-0cb029"},"children":[{"type":"text","value":"// pass your index name as param"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"class":"ct-54935f"},"children":[{"type":"text","value":"const"}]},{"type":"element","tag":"span","props":{"class":"ct-dcad69"},"children":[{"type":"text","value":" { "}]},{"type":"element","tag":"span","props":{"class":"ct-f52cf9"},"children":[{"type":"text","value":"data"}]},{"type":"element","tag":"span","props":{"class":"ct-dcad69"},"children":[{"type":"text","value":" } "}]},{"type":"element","tag":"span","props":{"class":"ct-10533f"},"children":[{"type":"text","value":"="}]},{"type":"element","tag":"span","props":{"class":"ct-dcad69"},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"class":"ct-54935f"},"children":[{"type":"text","value":"await"}]},{"type":"element","tag":"span","props":{"class":"ct-dcad69"},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"class":"ct-861b72"},"children":[{"type":"text","value":"useAsyncData"}]},{"type":"element","tag":"span","props":{"class":"ct-dcad69"},"children":[{"type":"text","value":"("}]},{"type":"element","tag":"span","props":{"class":"ct-23564f"},"children":[{"type":"text","value":"'ssr-search-results'"}]},{"type":"element","tag":"span","props":{"class":"ct-dcad69"},"children":[{"type":"text","value":", () "}]},{"type":"element","tag":"span","props":{"class":"ct-54935f"},"children":[{"type":"text","value":"=>"}]},{"type":"element","tag":"span","props":{"class":"ct-dcad69"},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"class":"ct-861b72"},"children":[{"type":"text","value":"search"}]},{"type":"element","tag":"span","props":{"class":"ct-dcad69"},"children":[{"type":"text","value":"({ "}]},{"type":"element","tag":"span","props":{"class":"ct-87b207"},"children":[{"type":"text","value":"query"}]},{"type":"element","tag":"span","props":{"class":"ct-dcad69"},"children":[{"type":"text","value":": "}]},{"type":"element","tag":"span","props":{"class":"ct-23564f"},"children":[{"type":"text","value":"'Samsung'"}]},{"type":"element","tag":"span","props":{"class":"ct-dcad69"},"children":[{"type":"text","value":" }))"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"class":"ct-dcad69"},"children":[{"type":"text","value":"</"}]},{"type":"element","tag":"span","props":{"class":"ct-87b207"},"children":[{"type":"text","value":"script"}]},{"type":"element","tag":"span","props":{"class":"ct-dcad69"},"children":[{"type":"text","value":">"}]}]}]}]}]},{"type":"element","tag":"ul","props":{},"children":[{"type":"element","tag":"li","props":{},"children":[{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"result"}]},{"type":"text","value":" will contain a value of a search method. It is reactive computed property that will be populated when a search method will fulfill. This result will have a form described "},{"type":"element","tag":"a","props":{"href":"https://www.algolia.com/doc/api-reference/api-methods/search/#response","rel":["nofollow","noopener","noreferrer"],"target":"_blank"},"children":[{"type":"text","value":"here"}]}]},{"type":"element","tag":"li","props":{},"children":[{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"search"}]},{"type":"text","value":" method is used to fetch the results by the index and populates "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"result"}]},{"type":"text","value":" reactive property. This method requires a parameter "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"query"}]},{"type":"text","value":" and accepts an optional parameter of "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"requestOptions"}]},{"type":"text","value":" that you can check out "},{"type":"element","tag":"a","props":{"href":"https://www.algolia.com/doc/api-reference/api-methods/search/#method-param-requestoptions","rel":["nofollow","noopener","noreferrer"],"target":"_blank"},"children":[{"type":"text","value":"here"}]}]}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"For more details check out the official documentation of this method "},{"type":"element","tag":"a","props":{"href":"https://www.algolia.com/doc/api-client/methods/search/","rel":["nofollow","noopener","noreferrer"],"target":"_blank"},"children":[{"type":"text","value":"here"}]}]},{"type":"element","tag":"h2","props":{"id":"useasyncalgoliasearch"},"children":[{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"useAsyncAlgoliaSearch"}]}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"Async wrapper around "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"useAlgoliaSearch"}]},{"type":"text","value":" composable that decreases the number of steps needed to use Algolia with "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"useAsyncData"}]},{"type":"text","value":" while maintaining the same functionality. The response will have a form described "},{"type":"element","tag":"a","props":{"href":"https://www.algolia.com/doc/api-reference/api-methods/search/#response","rel":["nofollow","noopener","noreferrer"],"target":"_blank"},"children":[{"type":"text","value":"here"}]},{"type":"text","value":" and will be wrapped around "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"useAsyncData"}]},{"type":"text","value":" so you will have access to "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"data"}]},{"type":"text","value":", "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"error"}]},{"type":"text","value":", and other properties."}]},{"type":"element","tag":"code","props":{"code":"<script setup lang=\"ts\">\nconst { data, error } = await useAsyncAlgoliaSearch({ indexName: 'test_index', query: 'Samsung' })\n</script>\n\n<template>\n  <div>{{ data.value.hits }}</div>\n</template>\n","language":"vue"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"class":"ct-dcad69"},"children":[{"type":"text","value":"<"}]},{"type":"element","tag":"span","props":{"class":"ct-87b207"},"children":[{"type":"text","value":"script"}]},{"type":"element","tag":"span","props":{"class":"ct-dcad69"},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"class":"ct-4770c2"},"children":[{"type":"text","value":"setup"}]},{"type":"element","tag":"span","props":{"class":"ct-dcad69"},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"class":"ct-4770c2"},"children":[{"type":"text","value":"lang"}]},{"type":"element","tag":"span","props":{"class":"ct-dcad69"},"children":[{"type":"text","value":"="}]},{"type":"element","tag":"span","props":{"class":"ct-23564f"},"children":[{"type":"text","value":"\"ts\""}]},{"type":"element","tag":"span","props":{"class":"ct-dcad69"},"children":[{"type":"text","value":">"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"class":"ct-54935f"},"children":[{"type":"text","value":"const"}]},{"type":"element","tag":"span","props":{"class":"ct-dcad69"},"children":[{"type":"text","value":" { "}]},{"type":"element","tag":"span","props":{"class":"ct-f52cf9"},"children":[{"type":"text","value":"data"}]},{"type":"element","tag":"span","props":{"class":"ct-dcad69"},"children":[{"type":"text","value":", "}]},{"type":"element","tag":"span","props":{"class":"ct-f52cf9"},"children":[{"type":"text","value":"error"}]},{"type":"element","tag":"span","props":{"class":"ct-dcad69"},"children":[{"type":"text","value":" } "}]},{"type":"element","tag":"span","props":{"class":"ct-10533f"},"children":[{"type":"text","value":"="}]},{"type":"element","tag":"span","props":{"class":"ct-dcad69"},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"class":"ct-54935f"},"children":[{"type":"text","value":"await"}]},{"type":"element","tag":"span","props":{"class":"ct-dcad69"},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"class":"ct-861b72"},"children":[{"type":"text","value":"useAsyncAlgoliaSearch"}]},{"type":"element","tag":"span","props":{"class":"ct-dcad69"},"children":[{"type":"text","value":"({ "}]},{"type":"element","tag":"span","props":{"class":"ct-87b207"},"children":[{"type":"text","value":"indexName"}]},{"type":"element","tag":"span","props":{"class":"ct-dcad69"},"children":[{"type":"text","value":": "}]},{"type":"element","tag":"span","props":{"class":"ct-23564f"},"children":[{"type":"text","value":"'test_index'"}]},{"type":"element","tag":"span","props":{"class":"ct-dcad69"},"children":[{"type":"text","value":", "}]},{"type":"element","tag":"span","props":{"class":"ct-87b207"},"children":[{"type":"text","value":"query"}]},{"type":"element","tag":"span","props":{"class":"ct-dcad69"},"children":[{"type":"text","value":": "}]},{"type":"element","tag":"span","props":{"class":"ct-23564f"},"children":[{"type":"text","value":"'Samsung'"}]},{"type":"element","tag":"span","props":{"class":"ct-dcad69"},"children":[{"type":"text","value":" })"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"class":"ct-dcad69"},"children":[{"type":"text","value":"</"}]},{"type":"element","tag":"span","props":{"class":"ct-87b207"},"children":[{"type":"text","value":"script"}]},{"type":"element","tag":"span","props":{"class":"ct-dcad69"},"children":[{"type":"text","value":">"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"class":"ct-dcad69"},"children":[{"type":"text","value":"<"}]},{"type":"element","tag":"span","props":{"class":"ct-87b207"},"children":[{"type":"text","value":"template"}]},{"type":"element","tag":"span","props":{"class":"ct-dcad69"},"children":[{"type":"text","value":">"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"class":"ct-dcad69"},"children":[{"type":"text","value":"  <"}]},{"type":"element","tag":"span","props":{"class":"ct-4770c2"},"children":[{"type":"text","value":"div"}]},{"type":"element","tag":"span","props":{"class":"ct-dcad69"},"children":[{"type":"text","value":">{{ "}]},{"type":"element","tag":"span","props":{"class":"ct-4770c2"},"children":[{"type":"text","value":"data"}]},{"type":"element","tag":"span","props":{"class":"ct-dcad69"},"children":[{"type":"text","value":"."}]},{"type":"element","tag":"span","props":{"class":"ct-4770c2"},"children":[{"type":"text","value":"value"}]},{"type":"element","tag":"span","props":{"class":"ct-dcad69"},"children":[{"type":"text","value":"."}]},{"type":"element","tag":"span","props":{"class":"ct-4770c2"},"children":[{"type":"text","value":"hits"}]},{"type":"element","tag":"span","props":{"class":"ct-dcad69"},"children":[{"type":"text","value":" }}</"}]},{"type":"element","tag":"span","props":{"class":"ct-4770c2"},"children":[{"type":"text","value":"div"}]},{"type":"element","tag":"span","props":{"class":"ct-dcad69"},"children":[{"type":"text","value":">"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"class":"ct-dcad69"},"children":[{"type":"text","value":"</"}]},{"type":"element","tag":"span","props":{"class":"ct-87b207"},"children":[{"type":"text","value":"template"}]},{"type":"element","tag":"span","props":{"class":"ct-dcad69"},"children":[{"type":"text","value":">"}]}]}]}]}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"This composable accepts an object as a param with following properties:"}]},{"type":"element","tag":"ul","props":{},"children":[{"type":"element","tag":"li","props":{},"children":[{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"indexName"}]},{"type":"text","value":" - the name of you index in Algolia dashboard. For more details about initializing index check out the official documentation "},{"type":"element","tag":"a","props":{"href":"https://www.algolia.com/doc/api-client/getting-started/instantiate-client-index/javascript/?client=javascript#initialize-an-index","rel":["nofollow","noopener","noreferrer"],"target":"_blank"},"children":[{"type":"text","value":"here"}]},{"type":"text","value":". If you passed a global index in your module configuration, this property can be skipped."}]},{"type":"element","tag":"li","props":{},"children":[{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"query"}]},{"type":"text","value":" - a keyword, sentence, or text that you want to search the index with."}]},{"type":"element","tag":"li","props":{},"children":[{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"key"}]},{"type":"text","value":" - if you need multiple asyncAlgoliaSearch calls in a single page, add a unique key to get passed to the useAsyncData underneath, so new calls won't overwrite old data."}]},{"type":"element","tag":"li","props":{},"children":[{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"requestOptions"}]},{"type":"text","value":" optional object with options for the request like filters. You can check more about is "},{"type":"element","tag":"a","props":{"href":"https://www.algolia.com/doc/api-reference/api-methods/search/#method-param-requestoptions","rel":["nofollow","noopener","noreferrer"],"target":"_blank"},"children":[{"type":"text","value":"here"}]}]}]},{"type":"element","tag":"h2","props":{"id":"usealgoliafacetedsearch"},"children":[{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"useAlgoliaFacetedSearch"}]}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"Use this composable to search using facet values like "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"category"}]},{"type":"text","value":", "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"phone"}]},{"type":"text","value":"."}]},{"type":"element","tag":"alert","props":{"type":"info"},"children":[{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"In order for this to work, you have to add facet attributes in your dashboard or via code. Read more about it "},{"type":"element","tag":"a","props":{"href":"https://www.algolia.com/doc/guides/managing-results/refine-results/faceting/","rel":["nofollow","noopener","noreferrer"],"target":"_blank"},"children":[{"type":"text","value":"here"}]}]}]},{"type":"element","tag":"code","props":{"code":"<script setup>\nconst { result, search } = useAlgoliaFacetedSearch('test_index')\n\nonMounted(async () => {\n  const facet = { \n    name: 'category',\n    query: 'phone'\n   }\n  await search({ facet })\n})\n</script>\n","language":"vue"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"class":"ct-dcad69"},"children":[{"type":"text","value":"<"}]},{"type":"element","tag":"span","props":{"class":"ct-87b207"},"children":[{"type":"text","value":"script"}]},{"type":"element","tag":"span","props":{"class":"ct-dcad69"},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"class":"ct-4770c2"},"children":[{"type":"text","value":"setup"}]},{"type":"element","tag":"span","props":{"class":"ct-dcad69"},"children":[{"type":"text","value":">"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"class":"ct-54935f"},"children":[{"type":"text","value":"const"}]},{"type":"element","tag":"span","props":{"class":"ct-dcad69"},"children":[{"type":"text","value":" { "}]},{"type":"element","tag":"span","props":{"class":"ct-f52cf9"},"children":[{"type":"text","value":"result"}]},{"type":"element","tag":"span","props":{"class":"ct-dcad69"},"children":[{"type":"text","value":", "}]},{"type":"element","tag":"span","props":{"class":"ct-f52cf9"},"children":[{"type":"text","value":"search"}]},{"type":"element","tag":"span","props":{"class":"ct-dcad69"},"children":[{"type":"text","value":" } "}]},{"type":"element","tag":"span","props":{"class":"ct-10533f"},"children":[{"type":"text","value":"="}]},{"type":"element","tag":"span","props":{"class":"ct-dcad69"},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"class":"ct-861b72"},"children":[{"type":"text","value":"useAlgoliaFacetedSearch"}]},{"type":"element","tag":"span","props":{"class":"ct-dcad69"},"children":[{"type":"text","value":"("}]},{"type":"element","tag":"span","props":{"class":"ct-23564f"},"children":[{"type":"text","value":"'test_index'"}]},{"type":"element","tag":"span","props":{"class":"ct-dcad69"},"children":[{"type":"text","value":")"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"class":"ct-861b72"},"children":[{"type":"text","value":"onMounted"}]},{"type":"element","tag":"span","props":{"class":"ct-dcad69"},"children":[{"type":"text","value":"("}]},{"type":"element","tag":"span","props":{"class":"ct-54935f"},"children":[{"type":"text","value":"async"}]},{"type":"element","tag":"span","props":{"class":"ct-dcad69"},"children":[{"type":"text","value":" () "}]},{"type":"element","tag":"span","props":{"class":"ct-54935f"},"children":[{"type":"text","value":"=>"}]},{"type":"element","tag":"span","props":{"class":"ct-dcad69"},"children":[{"type":"text","value":" {"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"class":"ct-dcad69"},"children":[{"type":"text","value":"  "}]},{"type":"element","tag":"span","props":{"class":"ct-54935f"},"children":[{"type":"text","value":"const"}]},{"type":"element","tag":"span","props":{"class":"ct-dcad69"},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"class":"ct-f52cf9"},"children":[{"type":"text","value":"facet"}]},{"type":"element","tag":"span","props":{"class":"ct-dcad69"},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"class":"ct-10533f"},"children":[{"type":"text","value":"="}]},{"type":"element","tag":"span","props":{"class":"ct-dcad69"},"children":[{"type":"text","value":" { "}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"class":"ct-dcad69"},"children":[{"type":"text","value":"    "}]},{"type":"element","tag":"span","props":{"class":"ct-87b207"},"children":[{"type":"text","value":"name"}]},{"type":"element","tag":"span","props":{"class":"ct-dcad69"},"children":[{"type":"text","value":": "}]},{"type":"element","tag":"span","props":{"class":"ct-23564f"},"children":[{"type":"text","value":"'category'"}]},{"type":"element","tag":"span","props":{"class":"ct-dcad69"},"children":[{"type":"text","value":","}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"class":"ct-dcad69"},"children":[{"type":"text","value":"    "}]},{"type":"element","tag":"span","props":{"class":"ct-87b207"},"children":[{"type":"text","value":"query"}]},{"type":"element","tag":"span","props":{"class":"ct-dcad69"},"children":[{"type":"text","value":": "}]},{"type":"element","tag":"span","props":{"class":"ct-23564f"},"children":[{"type":"text","value":"'phone'"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"class":"ct-dcad69"},"children":[{"type":"text","value":"   }"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"class":"ct-dcad69"},"children":[{"type":"text","value":"  "}]},{"type":"element","tag":"span","props":{"class":"ct-54935f"},"children":[{"type":"text","value":"await"}]},{"type":"element","tag":"span","props":{"class":"ct-dcad69"},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"class":"ct-861b72"},"children":[{"type":"text","value":"search"}]},{"type":"element","tag":"span","props":{"class":"ct-dcad69"},"children":[{"type":"text","value":"({ "}]},{"type":"element","tag":"span","props":{"class":"ct-87b207"},"children":[{"type":"text","value":"facet"}]},{"type":"element","tag":"span","props":{"class":"ct-dcad69"},"children":[{"type":"text","value":" })"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"class":"ct-dcad69"},"children":[{"type":"text","value":"})"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"class":"ct-dcad69"},"children":[{"type":"text","value":"</"}]},{"type":"element","tag":"span","props":{"class":"ct-87b207"},"children":[{"type":"text","value":"script"}]},{"type":"element","tag":"span","props":{"class":"ct-dcad69"},"children":[{"type":"text","value":">"}]}]}]}]}]},{"type":"element","tag":"ul","props":{},"children":[{"type":"element","tag":"li","props":{},"children":[{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"result"}]},{"type":"text","value":" will contain a value of a search method. It is reactive computed property that will be populated when a search method will fulfill. This result will have a form described "},{"type":"element","tag":"a","props":{"href":"https://www.algolia.com/doc/api-reference/api-methods/search-for-facet-values/#response","rel":["nofollow","noopener","noreferrer"],"target":"_blank"},"children":[{"type":"text","value":"here"}]}]},{"type":"element","tag":"li","props":{},"children":[{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"search"}]},{"type":"text","value":" method is used to fetch the results by the certain facet value pairs like name and query, and populates "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"result"}]},{"type":"text","value":" reactive property. This method requries a parameter for "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"facet"}]},{"type":"text","value":" and accepts an optional parameter of "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"requestOptions"}]},{"type":"text","value":" that you can check out "},{"type":"element","tag":"a","props":{"href":"https://www.algolia.com/doc/api-reference/api-methods/search/#method-param-requestoptions","rel":["nofollow","noopener","noreferrer"],"target":"_blank"},"children":[{"type":"text","value":"here"}]}]}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"For more details about using this search method check out the official documentation "},{"type":"element","tag":"a","props":{"href":"https://www.algolia.com/doc/api-reference/api-methods/search-for-facet-values/","rel":["nofollow","noopener","noreferrer"],"target":"_blank"},"children":[{"type":"text","value":"here"}]}]},{"type":"element","tag":"h2","props":{"id":"usealgoliarecommend"},"children":[{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"useAlgoliaRecommend"}]}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"Use this composable to get the recommendations matching certain criteria optional request options."}]},{"type":"element","tag":"alert","props":{"type":"info"},"children":[{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"In order to make this composable work, make sure to setup a "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"recommend"}]},{"type":"text","value":" property to "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"true"}]},{"type":"text","value":" in algolia configuration in "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"nuxt.config.ts"}]},{"type":"text","value":"."}]}]},{"type":"element","tag":"code","props":{"code":"<script setup>\nconst { result, get } = useAlgoliaRecommend()\n\nonMounted(async () => {\n  await get({ queries: [{ indexName: 'test_index', model: 'related-products', objectID: 'dca44dd5-aea6-4553-a3af-fcbda981a2ef' }] });\n})\n</script>\n","language":"vue"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"class":"ct-dcad69"},"children":[{"type":"text","value":"<"}]},{"type":"element","tag":"span","props":{"class":"ct-87b207"},"children":[{"type":"text","value":"script"}]},{"type":"element","tag":"span","props":{"class":"ct-dcad69"},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"class":"ct-4770c2"},"children":[{"type":"text","value":"setup"}]},{"type":"element","tag":"span","props":{"class":"ct-dcad69"},"children":[{"type":"text","value":">"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"class":"ct-54935f"},"children":[{"type":"text","value":"const"}]},{"type":"element","tag":"span","props":{"class":"ct-dcad69"},"children":[{"type":"text","value":" { "}]},{"type":"element","tag":"span","props":{"class":"ct-f52cf9"},"children":[{"type":"text","value":"result"}]},{"type":"element","tag":"span","props":{"class":"ct-dcad69"},"children":[{"type":"text","value":", "}]},{"type":"element","tag":"span","props":{"class":"ct-f52cf9"},"children":[{"type":"text","value":"get"}]},{"type":"element","tag":"span","props":{"class":"ct-dcad69"},"children":[{"type":"text","value":" } "}]},{"type":"element","tag":"span","props":{"class":"ct-10533f"},"children":[{"type":"text","value":"="}]},{"type":"element","tag":"span","props":{"class":"ct-dcad69"},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"class":"ct-861b72"},"children":[{"type":"text","value":"useAlgoliaRecommend"}]},{"type":"element","tag":"span","props":{"class":"ct-dcad69"},"children":[{"type":"text","value":"()"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"class":"ct-861b72"},"children":[{"type":"text","value":"onMounted"}]},{"type":"element","tag":"span","props":{"class":"ct-dcad69"},"children":[{"type":"text","value":"("}]},{"type":"element","tag":"span","props":{"class":"ct-54935f"},"children":[{"type":"text","value":"async"}]},{"type":"element","tag":"span","props":{"class":"ct-dcad69"},"children":[{"type":"text","value":" () "}]},{"type":"element","tag":"span","props":{"class":"ct-54935f"},"children":[{"type":"text","value":"=>"}]},{"type":"element","tag":"span","props":{"class":"ct-dcad69"},"children":[{"type":"text","value":" {"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"class":"ct-dcad69"},"children":[{"type":"text","value":"  "}]},{"type":"element","tag":"span","props":{"class":"ct-54935f"},"children":[{"type":"text","value":"await"}]},{"type":"element","tag":"span","props":{"class":"ct-dcad69"},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"class":"ct-861b72"},"children":[{"type":"text","value":"get"}]},{"type":"element","tag":"span","props":{"class":"ct-dcad69"},"children":[{"type":"text","value":"({ "}]},{"type":"element","tag":"span","props":{"class":"ct-87b207"},"children":[{"type":"text","value":"queries"}]},{"type":"element","tag":"span","props":{"class":"ct-dcad69"},"children":[{"type":"text","value":": [{ "}]},{"type":"element","tag":"span","props":{"class":"ct-87b207"},"children":[{"type":"text","value":"indexName"}]},{"type":"element","tag":"span","props":{"class":"ct-dcad69"},"children":[{"type":"text","value":": "}]},{"type":"element","tag":"span","props":{"class":"ct-23564f"},"children":[{"type":"text","value":"'test_index'"}]},{"type":"element","tag":"span","props":{"class":"ct-dcad69"},"children":[{"type":"text","value":", "}]},{"type":"element","tag":"span","props":{"class":"ct-87b207"},"children":[{"type":"text","value":"model"}]},{"type":"element","tag":"span","props":{"class":"ct-dcad69"},"children":[{"type":"text","value":": "}]},{"type":"element","tag":"span","props":{"class":"ct-23564f"},"children":[{"type":"text","value":"'related-products'"}]},{"type":"element","tag":"span","props":{"class":"ct-dcad69"},"children":[{"type":"text","value":", "}]},{"type":"element","tag":"span","props":{"class":"ct-87b207"},"children":[{"type":"text","value":"objectID"}]},{"type":"element","tag":"span","props":{"class":"ct-dcad69"},"children":[{"type":"text","value":": "}]},{"type":"element","tag":"span","props":{"class":"ct-23564f"},"children":[{"type":"text","value":"'dca44dd5-aea6-4553-a3af-fcbda981a2ef'"}]},{"type":"element","tag":"span","props":{"class":"ct-dcad69"},"children":[{"type":"text","value":" }] });"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"class":"ct-dcad69"},"children":[{"type":"text","value":"})"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"class":"ct-dcad69"},"children":[{"type":"text","value":"</"}]},{"type":"element","tag":"span","props":{"class":"ct-87b207"},"children":[{"type":"text","value":"script"}]},{"type":"element","tag":"span","props":{"class":"ct-dcad69"},"children":[{"type":"text","value":">"}]}]}]}]}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"This composable returns the following:"}]},{"type":"element","tag":"ul","props":{},"children":[{"type":"element","tag":"li","props":{},"children":[{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"result"}]},{"type":"text","value":" will contain a value of a get method. It is reactive computed property that will be populated when a get method will fulfill. This result will have a form described "},{"type":"element","tag":"a","props":{"href":"https://www.algolia.com/doc/api-reference/api-methods/get-recommendations/#response","rel":["nofollow","noopener","noreferrer"],"target":"_blank"},"children":[{"type":"text","value":"here"}]}]},{"type":"element","tag":"li","props":{},"children":[{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"get"}]},{"type":"text","value":" method is used to get the recommendations based on the criteria described "},{"type":"element","tag":"a","props":{"href":"https://www.algolia.com/doc/api-reference/api-methods/get-recommendations/#parameters","rel":["nofollow","noopener","noreferrer"],"target":"_blank"},"children":[{"type":"text","value":"here"}]},{"type":"text","value":" and an optional parameter of "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"requestOptions"}]},{"type":"text","value":" that you can check out "},{"type":"element","tag":"a","props":{"href":"https://www.algolia.com/doc/api-reference/api-methods/search/#method-param-requestoptions","rel":["nofollow","noopener","noreferrer"],"target":"_blank"},"children":[{"type":"text","value":"here"}]}]}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"This composable also accepts an optional key parameter:"}]},{"type":"element","tag":"ul","props":{},"children":[{"type":"element","tag":"li","props":{},"children":[{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"key"}]},{"type":"text","value":" - if you need multiple useAlgoliaRecommend calls, add a unique key to get passed to the userState('recommend-result') underneath, so new calls won't overwrite old data."}]}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"For more details check out the official documentation of this method "},{"type":"element","tag":"a","props":{"href":"https://www.algolia.com/doc/api-reference/api-methods/get-recommendations/","rel":["nofollow","noopener","noreferrer"],"target":"_blank"},"children":[{"type":"text","value":"here"}]}]},{"type":"element","tag":"h2","props":{"id":"usealgoliaref"},"children":[{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"useAlgoliaRef"}]}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"By calling this composable you have access to "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"algoliasearch"}]},{"type":"text","value":" instance anywhere in your app"}]},{"type":"element","tag":"code","props":{"code":"<script setup>\nconst algolia = useAlgoliaRef()\n</script>\n","language":"vue"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"class":"ct-dcad69"},"children":[{"type":"text","value":"<"}]},{"type":"element","tag":"span","props":{"class":"ct-87b207"},"children":[{"type":"text","value":"script"}]},{"type":"element","tag":"span","props":{"class":"ct-dcad69"},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"class":"ct-4770c2"},"children":[{"type":"text","value":"setup"}]},{"type":"element","tag":"span","props":{"class":"ct-dcad69"},"children":[{"type":"text","value":">"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"class":"ct-54935f"},"children":[{"type":"text","value":"const"}]},{"type":"element","tag":"span","props":{"class":"ct-dcad69"},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"class":"ct-f52cf9"},"children":[{"type":"text","value":"algolia"}]},{"type":"element","tag":"span","props":{"class":"ct-dcad69"},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"class":"ct-10533f"},"children":[{"type":"text","value":"="}]},{"type":"element","tag":"span","props":{"class":"ct-dcad69"},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"class":"ct-861b72"},"children":[{"type":"text","value":"useAlgoliaRef"}]},{"type":"element","tag":"span","props":{"class":"ct-dcad69"},"children":[{"type":"text","value":"()"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"class":"ct-dcad69"},"children":[{"type":"text","value":"</"}]},{"type":"element","tag":"span","props":{"class":"ct-87b207"},"children":[{"type":"text","value":"script"}]},{"type":"element","tag":"span","props":{"class":"ct-dcad69"},"children":[{"type":"text","value":">"}]}]}]}]}]},{"type":"element","tag":"h2","props":{"id":"usealgoliainitindex"},"children":[{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"useAlgoliaInitIndex"}]}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"Use this composable to initialize index you would like to search through. It accepts an index name as a parameter"}]},{"type":"element","tag":"code","props":{"code":"<script setup>\nconst algoliaIndex = useAlgoliaInitIndex('test')\n\nconsole.log(algoliaIndex.appId)\n</script>\n","language":"vue"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"class":"ct-dcad69"},"children":[{"type":"text","value":"<"}]},{"type":"element","tag":"span","props":{"class":"ct-87b207"},"children":[{"type":"text","value":"script"}]},{"type":"element","tag":"span","props":{"class":"ct-dcad69"},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"class":"ct-4770c2"},"children":[{"type":"text","value":"setup"}]},{"type":"element","tag":"span","props":{"class":"ct-dcad69"},"children":[{"type":"text","value":">"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"class":"ct-54935f"},"children":[{"type":"text","value":"const"}]},{"type":"element","tag":"span","props":{"class":"ct-dcad69"},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"class":"ct-f52cf9"},"children":[{"type":"text","value":"algoliaIndex"}]},{"type":"element","tag":"span","props":{"class":"ct-dcad69"},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"class":"ct-10533f"},"children":[{"type":"text","value":"="}]},{"type":"element","tag":"span","props":{"class":"ct-dcad69"},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"class":"ct-861b72"},"children":[{"type":"text","value":"useAlgoliaInitIndex"}]},{"type":"element","tag":"span","props":{"class":"ct-dcad69"},"children":[{"type":"text","value":"("}]},{"type":"element","tag":"span","props":{"class":"ct-23564f"},"children":[{"type":"text","value":"'test'"}]},{"type":"element","tag":"span","props":{"class":"ct-dcad69"},"children":[{"type":"text","value":")"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"class":"ct-f52cf9"},"children":[{"type":"text","value":"console"}]},{"type":"element","tag":"span","props":{"class":"ct-dcad69"},"children":[{"type":"text","value":"."}]},{"type":"element","tag":"span","props":{"class":"ct-861b72"},"children":[{"type":"text","value":"log"}]},{"type":"element","tag":"span","props":{"class":"ct-dcad69"},"children":[{"type":"text","value":"("}]},{"type":"element","tag":"span","props":{"class":"ct-f52cf9"},"children":[{"type":"text","value":"algoliaIndex"}]},{"type":"element","tag":"span","props":{"class":"ct-dcad69"},"children":[{"type":"text","value":"."}]},{"type":"element","tag":"span","props":{"class":"ct-87b207"},"children":[{"type":"text","value":"appId"}]},{"type":"element","tag":"span","props":{"class":"ct-dcad69"},"children":[{"type":"text","value":")"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"class":"ct-dcad69"},"children":[{"type":"text","value":"</"}]},{"type":"element","tag":"span","props":{"class":"ct-87b207"},"children":[{"type":"text","value":"script"}]},{"type":"element","tag":"span","props":{"class":"ct-dcad69"},"children":[{"type":"text","value":">"}]}]}]}]}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"For more details about initializing index check out the official documentation "},{"type":"element","tag":"a","props":{"href":"https://www.algolia.com/doc/api-client/getting-started/instantiate-client-index/javascript/?client=javascript#initialize-an-index","rel":["nofollow","noopener","noreferrer"],"target":"_blank"},"children":[{"type":"text","value":"here"}]}]},{"type":"element","tag":"style","children":[{"type":"text","value":".ct-0cb029{color:#7F848E}.ct-23564f{color:#98C379}.ct-861b72{color:#61AFEF}.ct-10533f{color:#56B6C2}.ct-f52cf9{color:#E5C07B}.ct-54935f{color:#C678DD}.ct-4770c2{color:#D19A66}.ct-87b207{color:#E06C75}.ct-dcad69{color:#ABB2BF}"}]}],"toc":{"title":"","searchDepth":2,"depth":2,"links":[{"id":"usealgoliasearch","depth":2,"text":"useAlgoliaSearch"},{"id":"useasyncalgoliasearch","depth":2,"text":"useAsyncAlgoliaSearch"},{"id":"usealgoliafacetedsearch","depth":2,"text":"useAlgoliaFacetedSearch"},{"id":"usealgoliarecommend","depth":2,"text":"useAlgoliaRecommend"},{"id":"usealgoliaref","depth":2,"text":"useAlgoliaRef"},{"id":"usealgoliainitindex","depth":2,"text":"useAlgoliaInitIndex"}]}},"_type":"markdown","_id":"content:1.getting-started:3.usage.md","_source":"content","_file":"1.getting-started/3.usage.md","_extension":"md"}]