Fireship · @fireship
Angular 4 Full Text Search with Algolia - Part 1
Uploaded July 17, 2017 · Length 4:29
Summary
Implementing full text search in Angular 4 with Algolia's Instant Search library and Firebase Cloud Functions.
- angular 4
- algolia
- instant search
- full text search
- firebase cloud functions
Transcript preview
The first 2 minutes of the transcript. Select a timestamp to watch that moment on YouTube.
- 0:00
in this episode we're going to use the
- 0:02
algo Lea search platform to implement
- 0:04
full text search into an angular 4
- 0:06
application
- 0:07
algo Lea provides a library called
- 0:09
instant search Jas which we'll use to
- 0:11
implement all kinds of different widgets
- 0:13
into our search with very little code
- 0:15
when you sign up for algo Lea it
- 0:18
provides a default index of Hollywood
- 0:20
actors we'll be using this index on the
- 0:22
first video then in the second video
- 0:24
we'll create our own custom index with
- 0:26
firebase cloud functions the first step
- 0:29
is to sign up for an algo Lea account
- 0:30
and get your API credentials they have a
- 0:33
free tier which is just limited by usage
- 0:36
after you sign up you'll go through a
- 0:38
new user tour and then you'll want to
- 0:40
make note of your search on the API key
- 0:42
and your app ID inside the angular
- 0:46
project you'll run NPM install instant
- 0:48
search jas instant search is an open
- 0:51
source library maintained by algo Lea it
- 0:54
takes care of all the front-end features
- 0:55
like autocomplete pagination filtering
- 0:58
and a lot more in angular I'm going to
- 1:01
add my API keys to the environment file
- 1:03
and specify that get started actors
- 1:06
index if you want to use the instant
- 1:09
search default CSS you can add that to
- 1:11
the head of the index.html file now we
- 1:15
can generate a new component called
- 1:16
search UI component we start by
- 1:19
importing the environment file and the
- 1:22
instant search package we declare a
- 1:25
variable search which will hold the
- 1:26
entire configuration for this search
- 1:28
feature then we pass it the
- 1:30
configuration from the environment file
- 1:32
and to initialize it we call search dot
- 1:35
start at this point nothing will happen
- 1:38
because we don't have any widgets
- 1:40
attached to the search instance so we'll
- 1:42
go ahead and give it a search box widget
- 1:44
and every widget has its own
- 1:46
configuration options the most important
- 1:48
being the container option which points
- 1:51
to an HTML element that will be replaced
- 1:53
by this widget so now that we have a
- 1:56
place for the user to enter their search
- 1:58
we need another div that will hold the


