3 changed files with 0 additions and 59 deletions
@ -1,20 +0,0 @@ |
|||||
#! /usr/bin/python3 |
|
||||
from search import indexListing |
|
||||
from textbookExceptions import UnIndexable |
|
||||
from mcmaster.classes import allCourses |
|
||||
from search import indexListing, createIndex |
|
||||
from itertools import imap |
|
||||
|
|
||||
try: |
|
||||
print("Trying to create the index if it does not exist already") |
|
||||
createIndex("oersearch") |
|
||||
except Exception as e: |
|
||||
print(e) |
|
||||
|
|
||||
print("Downloading course info") |
|
||||
for c in allCourses(): |
|
||||
try: |
|
||||
print(c) |
|
||||
print(indexListing(c)) |
|
||||
except UnIndexable as e: |
|
||||
print(e) |
|
@ -1,39 +0,0 @@ |
|||||
#! /usr/bin/python2 |
|
||||
|
|
||||
from elasticsearch_dsl import DocType, Date, Nested, Boolean, \ |
|
||||
analyzer, InnerObjectWrapper, Completion, Keyword, Text, Object |
|
||||
|
|
||||
from elasticsearch_dsl.connections import connections |
|
||||
|
|
||||
connections.create_connection(hosts=["localhost"]) |
|
||||
|
|
||||
class TextBook(InnerObjectWrapper): |
|
||||
pass |
|
||||
|
|
||||
class Section(InnerObjectWrapper): |
|
||||
pass |
|
||||
|
|
||||
class Course(DocType): |
|
||||
textbook = Object( |
|
||||
doc_class=TextBook, |
|
||||
properties = { |
|
||||
"author" : Text(), |
|
||||
"title" : Text(), |
|
||||
"price" : Text() |
|
||||
} |
|
||||
) |
|
||||
|
|
||||
sections = Object( |
|
||||
doc_class=Section, |
|
||||
properties = { |
|
||||
"sem" : Keyword(), |
|
||||
"title" : Text(), |
|
||||
"prof" : Text(), |
|
||||
"loc" : Text(), |
|
||||
"time" : Text(), |
|
||||
"day" : Text() |
|
||||
} |
|
||||
) |
|
||||
|
|
||||
class Meta: |
|
||||
index = "course_test" |
|
|
Loading…
Reference in new issue