Guest User

Untitled

a guest
Jul 9th, 2021
35
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.67 KB | None | 0 0
  1. <!-- Scripts -->
  2. <script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/typesense-instantsearch-adapter.min.js"></script>
  3. <script src="https://unpkg.com/[email protected]/dist/vue.js"></script>
  4. <script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/vue-instantsearch.js"></script>
  5. <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/themes/satellite-min.css" integrity="sha256-TehzF/2QvNKhGQrrNpoOb2Ck4iGZ1J/DI4pkd2oUsBc=" crossorigin="anonymous">
  6.  
  7. <div id="app">
  8. <template>
  9. <ais-instant-search :search-client="searchClient" index-name="multiple_choice_questions">
  10. <ais-search-box />
  11.  
  12. <ais-hits>
  13.  
  14. <template slot="item" slot-scope="{ item }">
  15. <h2>{{ item.question }}</h2>
  16. </template>
  17.  
  18. </ais-hits>
  19. </ais-instant-search>
  20. </template>
  21. </div>
  22.  
  23. <script>
  24. const typesenseInstantsearchAdapter = new TypesenseInstantSearchAdapter({
  25. server: {
  26. apiKey: "xxx", // Be sure to use the search-only-api-key
  27. nodes: [
  28. {
  29. host: "ivtxh84dyluoznpfp-1.a1.typesense.net",
  30. port: "443",
  31. protocol: "https"
  32. }
  33. ]
  34. },
  35. // The following parameters are directly passed to Typesense's search API endpoint.
  36. // So you can pass any parameters supported by the search endpoint below.
  37. // queryBy is required.
  38. additionalSearchParameters: {
  39. queryBy: "question"
  40. }
  41. });
  42. const searchClient = typesenseInstantsearchAdapter.searchClient;
  43.  
  44. new Vue({
  45. el: '#app',
  46. data: {
  47. searchClient: typesenseInstantsearchAdapter.searchClient,
  48. item: {}
  49. }
  50. })
  51.  
  52.  
  53. </script>
  54.  
Advertisement
Add Comment
Please, Sign In to add comment