Browse Source

update mapping for filters

master
wes 9 years ago
parent
commit
5e113211bc
  1. 2
      course.json
  2. 2
      course_mapping.rkt
  3. 2
      schemadsl.rkt
  4. 3
      src/scripts/search.js
  5. 9
      src/search.py
  6. 2
      src/styles/search.scss

2
course.json

@ -1 +1 @@
{"course":{"properties":{"textbooks":{"properties":{"author":{"type":"string","index":"analyzed"},"price":{"type":"string","index":"analyzed"},"title":{"type":"string","index":"analyzed"}}},"sections":{"properties":{"time":{"type":"string","index":"analyzed"},"title":{"type":"string","index":"analyzed"},"loc":{"type":"string","index":"analyzed"},"prof":{"type":"string","index":"analyzed"},"sem":{"type":"string","index":"analyzed"},"day":{"type":"string","index":"analyzed"}}}}}}
{"course":{"properties":{"textbooks":{"properties":{"author":{"type":"string","index":"analyzed"},"title":{"type":"string","index":"analyzed"},"price":{"type":"string","index":"analyzed"}}},"sections":{"properties":{"sem":{"type":"string","index":"not_analyzed"},"title":{"type":"string","index":"analyzed"},"prof":{"type":"string","index":"analyzed"},"loc":{"type":"string","index":"analyzed"},"time":{"type":"string","index":"analyzed"},"day":{"type":"string","index":"analyzed"}}}}}}

2
course_mapping.rkt

@ -10,7 +10,7 @@
,(str "time")
,(str "loc")
,(str "prof")
,(str "sem")
,(atom "sem")
,(str "day")))
,(estruct "textbooks"

2
schemadsl.rkt

@ -36,6 +36,8 @@
(define str (prop "string"))
(define atom (prop "string" "not_analyzed"))
(define num (prop "integer"))
(define date (prop "date"))

3
src/scripts/search.js

@ -76,11 +76,12 @@ function filterCourses(courses) {
return R.filter(
function (c) {
return c.prof != "Staff";
return c.prof != "Staff" && c.sem == "Winter";
}, courses);
}
function groupsof(n, xs) {
/* Chunk a list into groups of n size */
return R.unfold(
function(xs) {
if (R.length(xs) > 0) {

9
src/search.py

@ -136,6 +136,12 @@ def search(field):
return q
return s
def filterSem(term):
return Q("terms",
**{
"sem" : [term]
})
def join(x, y):
"""
Join two queries
@ -178,6 +184,7 @@ def searchTerms(terms):
.query(q))[0:100] # only return up to 100 results for now
results = s.execute()
syslog(repr(results))
filtered = [
(secs, filterSections(secs)[0].to_dict()) # get rid of tutorials
@ -213,5 +220,5 @@ searchers = {
"loc" : search("loc"),
"time" : search("time"),
"prof" : search("prof"),
"day" : search("day"),
"day" : search("day")
}

2
src/styles/search.scss

@ -46,7 +46,7 @@ a {
}
.courses {
margin-bottom: 50px;
@media (min-width: 1335px) {
margin-top: 20px;
max-width: 75%;

Loading…
Cancel
Save