Fireship · @fireship

Algolia Firestore Instant Search

Uploaded May 31, 2018 · Length 9:53

Algolia Firestore Instant Search

Summary

build instant search features with algolia and firestore using cloud functions and angular

  • algolia
  • firestore
  • instant search
  • cloud functions
  • angular

Transcript preview

The first 2 minutes of the transcript. Select a timestamp to watch that moment on YouTube.

  1. 0:00

    [Music]

  2. 0:01

    one of the most powerful integrations

  3. 0:04

    you can make with fire store is algo

  4. 0:06

    Leah it converts your fire store

  5. 0:07

    database into a full-text search engine

  6. 0:09

    which means that you can build instant

  7. 0:11

    search features that are extremely fast

  8. 0:13

    and sophisticated in this episode I'm

  9. 0:15

    going to show you how to automatically

  10. 0:17

    index all of your data in fire store

  11. 0:19

    using cloud functions and then we'll

  12. 0:21

    build an instant search feature on the

  13. 0:22

    front end using angular 6 if you're new

  14. 0:24

    here make sure to LIKE and subscribe and

  15. 0:26

    you can grab the full source code from

  16. 0:28

    angular firebase com if you've been

  17. 0:30

    following the channel for a while you

  18. 0:31

    might remember episode 27 where we

  19. 0:34

    created an algo leah feature with the

  20. 0:35

    real time database but a lot has changed

  21. 0:37

    since then we now have fire store cloud

  22. 0:40

    functions 1.0 angular 6 and algo leah

  23. 0:43

    also released their own angular instant

  24. 0:45

    search component library and I think

  25. 0:48

    this is a really important topic because

  26. 0:49

    I end up using algo leah and a lot of

  27. 0:51

    projects that I work on it provides a

  28. 0:53

    great developer experience and also a

  29. 0:55

    great user experience for surge what

  30. 0:57

    we're building today is just a simple

  31. 0:59

    full-text search feature but it will set

  32. 1:01

    you up to index your data in algo Leah

  33. 1:03

    so you can build more complex features

  34. 1:04

    on top of it every time we save a

  35. 1:07

    document to the fire store database it

  36. 1:09

    will trigger a cloud function that will

  37. 1:11

    then transmit that data over to algo

  38. 1:13

    Leah so it can be indexed on their

  39. 1:14

    servers once it's indexed you can then

  40. 1:17

    query it using one of their client-side

  41. 1:18

    API s in this case we're using angular

  42. 1:20

    but you could also use iOS react or

  43. 1:23

    whatever you want to get started you'll

  44. 1:26

    need to sign up for a now goli account

  45. 1:27

    and they do have a free tier that's

  46. 1:29

    pretty generous and we'll also choose a

  47. 1:31

    data center I'm just going with one in

  48. 1:32

    the u.s. that has the lowest latency

  49. 1:35

    after you sign up head over to the

  50. 1:37

    indices tab and then we'll create our

  51. 1:39

    first index you can think of an index is

  52. 1:42

    just a collection that you want to

  53. 1:44

    search across in our case it'll be a

  54. 1:46

    single firestore collection but you

  55. 1:48

    could even combine multiple sub

  56. 1:49

    collections into a single index to

  57. 1:51

    search across all of your sub

  58. 1:53

    collections throughout your fire store

  59. 1:54

    database now that we have our index

  60. 1:56

    created we need to add some data to it

  61. 1:58

    with a firebase cloud function but first