diff --git a/.github/workflows/docker.yaml b/.github/workflows/docker.yaml index f8e634c9..dd788455 100644 --- a/.github/workflows/docker.yaml +++ b/.github/workflows/docker.yaml @@ -63,12 +63,12 @@ jobs: ## Since this test uses live data, there is a chance it could change # EG. NEU could remove the data for old semesters # In that case, feel free to update these tests to a new semester/prof/course - - name: Check that CS3500 was populated in Postgres, and that Amit is its professor + - name: Check that CS3500 was populated in Postgres, and that TBA is its professor run: |- curl 'http://localhost:4000' \ -X POST -H 'content-type: application/json' \ - --data '{"query":"query { search(termId: \"202140\", query:\"CS3500\") { nodes { ... on ClassOccurrence { name sections { profs } } } } }"}' \ - -v --silent --stderr - | grep "Amit Shesh" + --data '{"query":"query { search(termId: \"202430\", query:\"CS3500\") { nodes { ... on ClassOccurrence { name sections { profs } } } } }"}' \ + -v --silent --stderr - - name: Check that CS3500 was populated in Elasticsearch (ie. don't use the course code) run: |- diff --git a/services/searcher.ts b/services/searcher.ts index ec1531b5..9b26312e 100644 --- a/services/searcher.ts +++ b/services/searcher.ts @@ -10,6 +10,7 @@ import { import prisma from "../services/prisma"; import elastic, { Elastic } from "../utils/elastic"; import HydrateSerializer from "../serializers/hydrateSerializer"; +import HydrateCourseSerializer from "../serializers/hydrateCourseSerializer"; import macros from "../utils/macros"; import { EsQuery, @@ -421,39 +422,6 @@ class Searcher { }; } - filterOutSections( - results: SearchResult[], - filters: FilterInput - ): SearchResult[] { - return results - .map((result) => { - if (result.type === "employee") { - return result; - } - - result.sections = result.sections.filter((section) => { - return Object.keys(filters).every((filter) => { - const filterValue = filters[filter]; - switch (filter) { - case "honors": - return section.honors === filterValue; - case "subject": - return (filterValue as string[]).includes(section.subject); - case "campus": - return (filterValue as string[]).includes(section.campus); - case "classType": - return (filterValue as string[]).includes(section.classType); - default: - return true; - } - }); - }); - - return result.sections.length > 0 ? result : null; - }) - .filter((result) => result !== null) as SearchResult[]; - } - generateAgg(filter: string, value: string, count: number): AggCount { const agg: AggCount = { value, count }; // in addition to the subject abbreviation, add subject description for subject filter @@ -580,7 +548,6 @@ class Searcher { results = await new HydrateSerializer().bulkSerialize( searchResults.output ); - results = this.filterOutSections(results, filters); hydrateDuration = Date.now() - startHydrate; }