Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
course-discovery
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
course-discovery
Commits
0898292c
Commit
0898292c
authored
Sep 12, 2016
by
Matthew Piatetsky
Committed by
GitHub
Sep 12, 2016
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #310 from edx/ECOM-5498
Expose uuids in catalog
parents
b021cf7f
90e1e17e
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
0 deletions
+21
-0
course_discovery/apps/course_metadata/search_indexes.py
+21
-0
No files found.
course_discovery/apps/course_metadata/search_indexes.py
View file @
0898292c
...
...
@@ -42,6 +42,9 @@ class BaseIndex(indexes.SearchIndex):
def
index_queryset
(
self
,
using
=
None
):
return
self
.
model
.
objects
.
all
()
def
prepare_authoring_organization_uuids
(
self
,
obj
):
return
[
str
(
organization
.
uuid
)
for
organization
in
obj
.
authoring_organizations
.
all
()]
class
BaseCourseIndex
(
OrganizationsMixin
,
BaseIndex
):
key
=
indexes
.
CharField
(
model_attr
=
'key'
,
stored
=
True
)
...
...
@@ -114,6 +117,9 @@ class CourseRunIndex(BaseCourseIndex, indexes.Indexable):
partner
=
indexes
.
CharField
(
null
=
True
,
faceted
=
True
)
program_types
=
indexes
.
MultiValueField
()
published
=
indexes
.
BooleanField
(
null
=
False
,
faceted
=
True
)
authoring_organization_uuids
=
indexes
.
MultiValueField
()
staff_uuids
=
indexes
.
MultiValueField
()
subject_uuids
=
indexes
.
MultiValueField
()
def
prepare_partner
(
self
,
obj
):
return
obj
.
course
.
partner
.
short_code
...
...
@@ -151,6 +157,12 @@ class CourseRunIndex(BaseCourseIndex, indexes.Indexable):
def
prepare_program_types
(
self
,
obj
):
return
obj
.
program_types
def
prepare_staff_uuids
(
self
,
obj
):
return
[
str
(
staff
.
uuid
)
for
staff
in
obj
.
staff
.
all
()]
def
prepare_subject_uuids
(
self
,
obj
):
return
[
str
(
subject
.
uuid
)
for
subject
in
obj
.
subjects
.
all
()]
class
ProgramIndex
(
BaseIndex
,
indexes
.
Indexable
,
OrganizationsMixin
):
model
=
Program
...
...
@@ -162,6 +174,9 @@ class ProgramIndex(BaseIndex, indexes.Indexable, OrganizationsMixin):
marketing_url
=
indexes
.
CharField
(
null
=
True
)
organizations
=
indexes
.
MultiValueField
(
faceted
=
True
)
authoring_organizations
=
indexes
.
MultiValueField
(
faceted
=
True
)
authoring_organization_uuids
=
indexes
.
MultiValueField
()
subject_uuids
=
indexes
.
MultiValueField
()
staff_uuids
=
indexes
.
MultiValueField
()
authoring_organization_bodies
=
indexes
.
MultiValueField
()
credit_backing_organizations
=
indexes
.
MultiValueField
(
faceted
=
True
)
card_image_url
=
indexes
.
CharField
(
model_attr
=
'card_image_url'
,
null
=
True
)
...
...
@@ -180,6 +195,12 @@ class ProgramIndex(BaseIndex, indexes.Indexable, OrganizationsMixin):
def
prepare_authoring_organization_bodies
(
self
,
obj
):
return
[
self
.
format_organization_body
(
organization
)
for
organization
in
obj
.
authoring_organizations
.
all
()]
def
prepare_subject_uuids
(
self
,
obj
):
return
[
str
(
subject
.
uuid
)
for
course
in
obj
.
courses
.
all
()
for
subject
in
course
.
subjects
.
all
()]
def
prepare_staff_uuids
(
self
,
obj
):
return
[
str
(
staff
.
uuid
)
for
course_run
in
obj
.
course_runs
.
all
()
for
staff
in
course_run
.
staff
.
all
()]
def
prepare_credit_backing_organizations
(
self
,
obj
):
return
self
.
_prepare_organizations
(
obj
.
credit_backing_organizations
.
all
())
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment