Build An Audio AI App Transcripts
Chapter: Feature 2: Search
Lecture: Real Search Results

Login or purchase this course to watch this video and the rest of the course contents.
0:00 We saw that we're getting really cool search queries coming in through our text changed HTML magic. Let's try a search, huh?
0:10 Okay, so over here we can say results equals, and we can go to the search service, and then we can just call search, and we give it all the text.
0:21 It doesn't matter how complicated it is. They could say, I want to know about the geese of Canada who flew over the Rocky Mountains,
0:27 but it was too cold one winter, so they stayed, whatever. We jam that into the search engine.
0:32 It uses the NLP stuff and breaks it into a bunch of keywords and then searches for it. So all we gotta do here is pass the search text in,
0:40 and we need to await this 'cause it's doing a whole bunch of async things, and this will be a raw search result for the moment.
0:49 This is not where we're gonna end up. I just wanna show you what is in here. So we have the search text, and let's just return a couple of things
0:57 and episodes like that, and then in our search results partial, we'll say there's a unordered list,
1:06 and then for each, we want a repeat for each podcast, but its title, let's just say podcasts. The way we do this in Chameleon,
1:15 we'll say tal colon repeat. It looks like an error, but don't worry about it. It's just PyCharm not really being great with it.
1:24 So we'll say P for in podcasts, and we'll just put $P.title, and then we're gonna do the same thing for the episodes just to see what...
1:35 E episodes and E. Let's restart it. See if I've got this all hanging together here. Refresh, and let's just type htmx.
1:51 See if anything talks about that. Oh my goodness, look how awesome. You search for htmx and you got podcasts, Talk Python to Me and Python Bytes.
2:00 What if we search for iPhone? Whoa, it looks like Accidental Tech Podcasts and Waveform. What if we search for Postgres DB? How insanely cool is that?
2:14 MongoDB, there you go. There's a few of them. Talked about it a few times. Oh my goodness, over on Talk Python to Me. I wonder why.
2:23 Well, that's how we can use MongoDB to put those keywords in there and create an index and do this really quick search.
2:31 I think it's not even possible to perceive how awesomely quick this is 'cause it has that 250 millisecond delay,
2:39 but we can just say it's fast, very fast.

Talk Python's Mastodon Michael Kennedy's Mastodon