From 8e8efee39a63c8c59acbc13cb36a4f6d94d79981 Mon Sep 17 00:00:00 2001 From: Ananya Patil <106994008+ananyaspatil@users.noreply.github.com> Date: Sun, 10 Nov 2024 14:50:58 -0500 Subject: [PATCH 1/6] Revert "Add section filters (#234)" This reverts commit 561f7ea58c9c329d414862cfa553614dd2c65801. --- services/searcher.ts | 35 +---------------------------------- 1 file changed, 1 insertion(+), 34 deletions(-) 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; } From 3f326a2af46c5d3bc0700830fe0e5e338b4ae0cf Mon Sep 17 00:00:00 2001 From: Anzhuo-W <45926251+Anzhuo-W@users.noreply.github.com> Date: Sun, 10 Nov 2024 15:04:22 -0500 Subject: [PATCH 2/6] try semester update in test --- .github/workflows/docker.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/docker.yaml b/.github/workflows/docker.yaml index f8e634c9..4ca5a348 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 Lucia Nunez 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 - | grep "Lucia Nunez" - name: Check that CS3500 was populated in Elasticsearch (ie. don't use the course code) run: |- From b157be284a6b3a7cebfdc36677778b36bf66c239 Mon Sep 17 00:00:00 2001 From: Anzhuo-W <45926251+Anzhuo-W@users.noreply.github.com> Date: Sun, 10 Nov 2024 15:53:56 -0500 Subject: [PATCH 3/6] test TBA --- .github/workflows/docker.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/docker.yaml b/.github/workflows/docker.yaml index 4ca5a348..c12fc3d1 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 Lucia Nunez 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: \"202430\", query:\"CS3500\") { nodes { ... on ClassOccurrence { name sections { profs } } } } }"}' \ - -v --silent --stderr - | grep "Lucia Nunez" + -v --silent --stderr - | grep "TBA" - name: Check that CS3500 was populated in Elasticsearch (ie. don't use the course code) run: |- From c3151bb2b51dd2b8a34ece021db9ce17bc1e62f6 Mon Sep 17 00:00:00 2001 From: Anzhuo-W <45926251+Anzhuo-W@users.noreply.github.com> Date: Sun, 10 Nov 2024 16:00:26 -0500 Subject: [PATCH 4/6] debug test --- .github/workflows/docker.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/docker.yaml b/.github/workflows/docker.yaml index c12fc3d1..769eaf67 100644 --- a/.github/workflows/docker.yaml +++ b/.github/workflows/docker.yaml @@ -68,7 +68,7 @@ jobs: curl 'http://localhost:4000' \ -X POST -H 'content-type: application/json' \ --data '{"query":"query { search(termId: \"202430\", query:\"CS3500\") { nodes { ... on ClassOccurrence { name sections { profs } } } } }"}' \ - -v --silent --stderr - | grep "TBA" + -v --silent --stderr - | tee - | grep "TBA" - name: Check that CS3500 was populated in Elasticsearch (ie. don't use the course code) run: |- From 959365d89da7120cd2a4954fc321f72d33695f8f Mon Sep 17 00:00:00 2001 From: Anzhuo-W <45926251+Anzhuo-W@users.noreply.github.com> Date: Sun, 10 Nov 2024 16:05:06 -0500 Subject: [PATCH 5/6] remove grep --- .github/workflows/docker.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/docker.yaml b/.github/workflows/docker.yaml index 769eaf67..1b634930 100644 --- a/.github/workflows/docker.yaml +++ b/.github/workflows/docker.yaml @@ -68,7 +68,7 @@ jobs: curl 'http://localhost:4000' \ -X POST -H 'content-type: application/json' \ --data '{"query":"query { search(termId: \"202430\", query:\"CS3500\") { nodes { ... on ClassOccurrence { name sections { profs } } } } }"}' \ - -v --silent --stderr - | tee - | grep "TBA" + -v --silent --stderr - | tee - | jq -S "." > debug.txt - name: Check that CS3500 was populated in Elasticsearch (ie. don't use the course code) run: |- From 4e7dff1663c1d458a62c75b3e105766e512ac630 Mon Sep 17 00:00:00 2001 From: Anzhuo-W <45926251+Anzhuo-W@users.noreply.github.com> Date: Sun, 10 Nov 2024 16:12:28 -0500 Subject: [PATCH 6/6] try just curl --- .github/workflows/docker.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/docker.yaml b/.github/workflows/docker.yaml index 1b634930..dd788455 100644 --- a/.github/workflows/docker.yaml +++ b/.github/workflows/docker.yaml @@ -68,7 +68,7 @@ jobs: curl 'http://localhost:4000' \ -X POST -H 'content-type: application/json' \ --data '{"query":"query { search(termId: \"202430\", query:\"CS3500\") { nodes { ... on ClassOccurrence { name sections { profs } } } } }"}' \ - -v --silent --stderr - | tee - | jq -S "." > debug.txt + -v --silent --stderr - - name: Check that CS3500 was populated in Elasticsearch (ie. don't use the course code) run: |-