File tree Expand file tree Collapse file tree 2 files changed +7
-16
lines changed Expand file tree Collapse file tree 2 files changed +7
-16
lines changed Original file line number Diff line number Diff line change 1
1
(ns cloujera.models.video
2
2
(:require [schema.core :as s]))
3
3
4
- (def fake-video
5
- {:id " 29"
6
- :title " Lecture 3 - Chapter 2: The industrial revolution starts in England"
7
- :transcript " The world we've seen is divided...(no timestamps!!)"
8
- :video-url " http://d396qusza40orc.cloudfront.net/susdev/recoded_videos%2Fsusdev_3_01.da6ff370809111e3af279b48f4519db4.webm"
9
- :_link " https://class.coursera.org/susdev-002/lecture/29"
10
- :course {:id " susdev-002"
11
- :title " The Age of Sustainable Development"
12
- :_link " https://class.coursera.org/susdev-002" }})
13
-
14
-
15
4
(def Course
16
5
" The schema for a Coursera Course (embedded in a video)"
17
6
{:id s/Str
25
14
" The schema for a Coursera Video"
26
15
{:id s/Str
27
16
:title s/Str
28
- :transcript s/Str
17
+ ( s/optional-key :transcript ) s/Str
29
18
(s/optional-key :highlighted-transcript ) s/Str
30
19
:video-url s/Str
31
20
:_link s/Str
Original file line number Diff line number Diff line change 24
24
25
25
(defn- extract-video-result [elastic-video]
26
26
(let [video (:_source elastic-video)
27
- elastic-highlight (get-in elastic-video [:highlight :transcript ])]
28
- (assoc video
29
- :highlighted-transcript
30
- (elastic-highlight->highlighted-transcript elastic-highlight))))
27
+ elastic-highlight (get-in elastic-video [:highlight :transcript ])
28
+ hl-transcript (elastic-highlight->highlighted-transcript elastic-highlight)
29
+ video+hl-transcript (assoc video
30
+ :highlighted-transcript
31
+ hl-transcript)]
32
+ (dissoc video :transcript )))
31
33
32
34
(defn- extract-results [videos]
33
35
(let [found-videos (get-in videos [:hits :hits ])]
You can’t perform that action at this time.
0 commit comments