Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Nathan R Lapierre
advisor
Commits
f5d8f75b
Commit
f5d8f75b
authored
Jan 28, 2014
by
Daniel W Bond
Browse files
added initial search_indexes.py
parent
88339853
Changes
1
Hide whitespace changes
Inline
Side-by-side
advisor/trajectories/search_indexes.py
0 → 100644
View file @
f5d8f75b
from
haystack
import
indexes
from
django.utils
import
timezone
# required for when the indexes were last updated
from
trajectories.models
import
Course
class
CourseIndex
(
indexes
.
SearchIndex
,
indexes
.
Indexable
):
# search result
# there can only be one document=True per model
text
=
indexes
.
CharField
(
document
=
True
,
use_template
=
True
)
# search filtering
name
=
indexes
.
CharField
(
model_attr
=
'name'
)
contents
=
indexes
.
CharField
(
model_attr
=
'courseDescription'
)
department
=
indexes
.
CharField
(
model_attr
=
'department'
)
departmentAbbr
=
indexes
.
CharField
(
model_attr
=
'departmentAbbr'
)
courseNumber
=
indexes
.
CharField
(
model_attr
=
'courseNumber'
)
def
get_model
(
self
):
return
Course
def
index_queryset
(
self
,
using
=
None
):
return
self
.
get_model
().
objects
.
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