add search
diff --git a/dtps.css b/dtps.css
index 62d2ec1..376d31e 100644
--- a/dtps.css
+++ b/dtps.css
@@ -220,11 +220,7 @@
     display: block !important;
 }
 
-body.dark .dash .colorBar {
-    background: var(--classColor);
-}
-
-body.light .dash .colorBar {
+.dash .colorBar {
     background: var(--classColor);
 }
 
@@ -1623,4 +1619,53 @@
     padding: 15px 18px;
     box-shadow: var(--elementShadow);
     margin: 24px 0px;
+}
+
+.card.searchResult {
+    padding: 15px 18px;
+    position: relative;
+    border-radius: var(--cardRadius);
+}
+
+.card.searchResult h4 {
+    font-size: 20px;
+    margin: 0px !important;
+    white-space: nowrap;
+    height: 24px;
+    line-height: 24px;
+    font-weight: bold;
+}
+
+.card.searchResult .highlight {
+    font-weight: bold;
+    background-color: var(--theme);
+    color: var(--themeText);
+}
+
+.card.searchResult .highlight i {
+    color: var(--themeText) !important;
+    font-weight: bold !important;
+}
+
+.card.searchResult .statusIcon {
+    font-size: 18px;
+    color: var(--secText);
+}
+
+.searchResult.mixedClasses .colorBar {
+    width: 7px;
+    height: calc(100% - 32px);
+    position: absolute;
+    top: 16px;
+    left: 14px;
+    border-radius: 10px;
+    display: block !important;
+}
+
+.searchResult.mixedClasses .colorBar {
+    background: var(--classColor);
+}
+
+.searchResult.mixedClasses {
+    padding-left: 34px;
 }
\ No newline at end of file
diff --git a/scripts/core.js b/scripts/core.js
index 0eba4ab..28f0d14 100644
--- a/scripts/core.js
+++ b/scripts/core.js
@@ -240,7 +240,7 @@
     });
 
     //Fuse.js is used for search
-    jQuery.getScript('https://cdnjs.cloudflare.com/ajax/libs/fuse.js/3.3.0/fuse.min.js');
+    jQuery.getScript('https://cdn.jsdelivr.net/npm/[email protected]');
 
     //jQuery UI for dashboard settings page
     jQuery.getScript('https://ajax.googleapis.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.js');
@@ -786,13 +786,11 @@
         //Change view to stream if coming from pages or discussions, since those tabs change the sidebar
         if ((dtps.selectedContent == "pages") || (dtps.selectedContent == "discuss")) {
             //Show stream
-            fluid.screen('stream', dtps.classes[dtps.selectedClass].id);
+            if (dtps.classes[dtps.selectedClass]) fluid.screen('stream', dtps.classes[dtps.selectedClass].id);
         }
 
         //Class onclick listener
         $(".class:not(.overrideClass)").click(function (event) {
-            dtps.presentClass(dtps.selectedClass);
-
             //Load class content based on what's selected
             if ((dtps.selectedContent == "stream") && dtps.classes[dtps.selectedClass]) {
                 fluid.screen("stream", dtps.classes[dtps.selectedClass].id);
@@ -841,9 +839,6 @@
         document.title = "Power+";
     }
 
-    //Set search box content
-    if (classNum !== "search") dtps.setSearchBox();
-
     //Set the class image
     if ((fluid.get("pref-showClassImages") !== "false") && dtps.classes[classNum] && dtps.classes[classNum].image) {
         $(".headerArea").addClass("classImage");
@@ -887,6 +882,9 @@
         $("#dtpsMainSearchBox").val("");
     }
 
+    //Set search box content
+    if (classNum !== "search") dtps.setSearchBox();
+
     if (dtps.classes[classNum]) {
         //Show pages tab if the class supports it, otherwise, hide it
         if (dtps.classes[classNum].pages) {
@@ -896,7 +894,7 @@
         }
 
         //Show people tab if the LMS supports it, otherwise, hide it
-        if (dtpsLMS.fetchUsers && !dtps.user.parent) {
+        if (dtps.classes[classNum].people) {
             $(".btns .btn.people").show();
         } else {
             $(".btns .btn.people").hide();
@@ -1391,13 +1389,14 @@
                 <p>By defualt, Power+ will search based on the page you're on. You can use the keywords below for more advanced searches:</p>
                 <div class="grid samesize">
                     <div class="item">
+                        <p><i class="material-icons">view_module</i> type:module</p>
                         <p><i class="material-icons">assignment</i> type:assignment</p>
                         <p><i class="material-icons">remove_circle_outline</i> type:missing</p>
                         <p><i class="material-icons">assignment_turned_in</i> type:turnedin</p>
-                        <p><i class="material-icons">view_module</i> type:module</p>
-                        <p><i class="material-icons">home</i> type:homepage</p>
+                        <p><i class="material-icons">assessment</i> type:grade</p>
                     </div>
                     <div class="item">
+                        <p><i class="material-icons">home</i> type:homepage</p>
                         <p><i class="material-icons">insert_drive_file</i> type:page</p>
                         <p><i class="material-icons">forum</i> type:discussion</p>
                         <p><i class="material-icons">people</i> type:person</p>
@@ -1494,8 +1493,12 @@
 
     $(document).on("keydown", "#dtpsMainSearchBox", function (e) {
         if (e.key == "Enter") {
-            fluid.screen("search", $("#dtpsMainSearchBox").val());
-            $("#dtpsMainSearchBox").blur();
+            //Validate input and tags
+            var term = $("#dtpsMainSearchBox").val().replace(/(type|class):[a-z]*/gi, "").trim();
+            if ($("#dtpsMainSearchBox").attr("data-search-type") && $("#dtpsMainSearchBox").attr("data-dtps-course")) {
+                fluid.screen("search", term);
+                $("#dtpsMainSearchBox").blur();
+            }
         }
     });
 }
@@ -1505,28 +1508,41 @@
  */
 dtps.setSearchBox = function () {
     var value = $("#dtpsMainSearchBox").val() || "";
+
     var type = null;
     var course = dtps.selectedClass == "dash" ? "dash" : dtps.classes[dtps.selectedClass];
     var icon = null;
+    var error = false;
 
     //Get automatic type from selected content
     if ((dtps.selectedContent == "stream") || (dtps.selectedContent == "moduleStream")) type = "coursework";
-    if (dtps.selectedContent == "people") type = "people"; 
-    if (dtps.selectedContent == "discuss") type = "discussions"; 
-    if (dtps.selectedContent == "pages") type = "pages"; 
+    if (dtps.selectedContent == "people") type = "people";
+    if (dtps.selectedContent == "discuss") type = "discussions";
+    if (dtps.selectedContent == "pages") type = "pages";
     if (dtps.selectedContent == "grades") type = "grades";
     if (dtps.selectedClass == "dash") type = "assignments";
 
+    //If search is open, reuse existing context
+    if (dtps.selectedClass == "search") {
+        type = $("#dtpsMainSearchBox").attr("data-search-type");
+        course = $("#dtpsMainSearchBox").attr("data-dtps-course");
+
+        if (!isNaN(Number(course))) {
+            course = dtps.classes[Number(course)];
+        }
+    }
+
     //Check for type override from search box
     if (value.split(" ").includes("type:assignment")) type = "assignments";
-    if (value.split(" ").includes("type:missing")) type = "missing assignments"; 
-    if (value.split(" ").includes("type:turnedin")) type = "turned in assignments"; 
-    if (value.split(" ").includes("type:module")) type = "modules"; 
+    if (value.split(" ").includes("type:missing")) type = "missing assignments";
+    if (value.split(" ").includes("type:turnedin")) type = "turned in assignments";
+    if (value.split(" ").includes("type:module")) type = "modules";
     if (value.split(" ").includes("type:homepage")) type = "homepages";
-    if (value.split(" ").includes("type:page")) type = "pages"; 
+    if (value.split(" ").includes("type:page")) type = "pages";
     if (value.split(" ").includes("type:discussion")) type = "discussions";
-    if (value.split(" ").includes("type:person")) type = "people"; 
-    if (value.split(" ").includes("type:all")) type = "everything"; 
+    if (value.split(" ").includes("type:grade")) type = "grades";
+    if (value.split(" ").includes("type:person")) type = "people";
+    if (value.split(" ").includes("type:all")) type = "everything";
 
     //Get icon from final type
     if (type == "coursework") icon = "library_books";
@@ -1555,14 +1571,33 @@
         }
     }
 
+    //Check if the course supports the type
+    if ((course !== "dash") && (course !== "all")) {
+        if ((type == "pages") && !course.pages) error = true;
+        if ((type == "discussions") && !course.discussions) error = true;
+        if ((type == "modules") && !course.modules) error = true;
+        if ((type == "homepages") && !course.homepage) error = true;
+        if ((type == "people") && !course.people) error = true;
+    }
+
     if ((course == "dash") || (course == "all")) {
         $("#dtpsSearchStatus i").text(icon);
         $("#dtpsSearchStatus span").text("Search " + (type == "everything" ? type : "all " + type));
         $("#dtpsMainSearchBox").attr("placeholder", "Search " + (type == "everything" ? type : "all " + type));
-    } else {
+        $("#dtpsMainSearchBox").attr("data-dtps-course", "all");
+        $("#dtpsMainSearchBox").attr("data-search-type", type);
+    } else if (error) {
+        $("#dtpsSearchStatus i").text("error");
+        $("#dtpsSearchStatus span").html(`Cannot search for ${type} in <b style="color: ${course.color};">${course.subject}</b>`);
+        $("#dtpsMainSearchBox").attr("placeholder", "Cannot search for " + type + " in " + course.subject);
+        $("#dtpsMainSearchBox").attr("data-dtps-course", "");
+        $("#dtpsMainSearchBox").attr("data-search-type", "");
+    } else if (course || true) {
         $("#dtpsSearchStatus i").text(icon);
         $("#dtpsSearchStatus span").html(`Search ${type} in <b style="color: ${course.color};">${course.subject}</b>`);
         $("#dtpsMainSearchBox").attr("placeholder", "Search " + type + " in " + course.subject);
+        $("#dtpsMainSearchBox").attr("data-dtps-course", course.num);
+        $("#dtpsMainSearchBox").attr("data-search-type", type);
     }
 }
 
@@ -1649,7 +1684,7 @@
                     <div onclick="fluid.set('pref-hideClassImages')" class="switch pref-hideClassImages"><span class="head"></span></div>
                     <div class="label"><i class="material-icons">image</i> Hide class images</div>
 
-                    ${dtpsLMS.dtech ? /*html*/`
+                    ${dtpsLMS.dtech && !dtps.user.parent ? /*html*/`
                             <br /><br />
                             <div onclick="fluid.set('pref-autoGroupClasses'); dtps.settingsReloadWarning();" class="switch pref-autoGroupClasses active"><span class="head"></span></div>
                             <div class="label"><i class="material-icons">sort</i> Automatically group and sort classes</div>
@@ -1657,7 +1692,7 @@
                             <div onclick="fluid.set('pref-formatAssignmentContent');" class="switch pref-formatAssignmentContent active"><span class="head"></span></div>
                             <div class="label"><i class="material-icons">format_paint</i> Reformat assignment content</div>
                         ` : ""
-        }
+                    }
 
                 </div>
 
@@ -2083,6 +2118,7 @@
 * @property {string} userID The ID of the user this class is associated with (from the parameter of dtpsLMS.fetchClasses)
 * @property {number} num Index of the class in the dtps.classes array
 * @property {string} subject Class subject
+* @property {boolean} [people] True if the class supports the "People" tab. If this is true dtpsLMS.fetchUsers must be implemented.
 * @property {string} [icon] The icon to show with this class
 * @property {string} [group] The name of the group that this class is in
 * @property {number|string} [period] The period or section the user has this class at
diff --git a/scripts/lms/canvas.js b/scripts/lms/canvas.js
index 2c9c59b..4ef6e2d 100644
--- a/scripts/lms/canvas.js
+++ b/scripts/lms/canvas.js
@@ -86,6 +86,7 @@
                     name: course.course_code,
                     id: course.id,
                     lmsID: course.id,
+                    people: !dtps.user.parent,
                     userID: userID,
                     period: course.sections && course.sections[0] && (course.sections.find(section => /[0-9](?=\(A)/.test(section.name)) || course.sections[0]).name,
                     subject: window.localStorage["pref-fullNames"] == "true" ? course.course_code : course.course_code.split(" - ")[0],
@@ -98,7 +99,7 @@
                     newDiscussionThreadURL: '/courses/' + course.id + '/discussion_topics/new',
                     pages: course.tabs.map(tab => tab.id).includes("pages"),
                     modules: course.tabs.map(tab => tab.id).includes("modules"),
-                    discussions: course.tabs.map(tab => tab.id).includes("discussions"),
+                    discussions: true || course.tabs.map(tab => tab.id).includes("discussions"),
                     endDate: course.end_at
                 };
 
diff --git a/scripts/lms/dtech.js b/scripts/lms/dtech.js
index c5daded..fc64cf4 100644
--- a/scripts/lms/dtech.js
+++ b/scripts/lms/dtech.js
@@ -78,7 +78,7 @@
                 }
 
                 //Check if course is ineligible for videoMeetingURL
-                if (!dtps.remoteConfig.showVideoMeetingButton || !course.homepage || (course.term !== dtps.remoteConfig.dtechCurrentTerm)) {
+                if (!dtps.remoteConfig.showVideoMeetingButton || dtps.user.parent || !course.homepage || (course.term !== dtps.remoteConfig.dtechCurrentTerm)) {
                     course.videoMeetingURL = null;
                 }
 
@@ -95,7 +95,7 @@
                 }
 
                 //Get course cycle
-                if (window.localStorage.getItem("pref-autoGroupClasses") !== "false") {
+                if (!dtps.user.parent && (window.localStorage.getItem("pref-autoGroupClasses") !== "false")) {
                     if ((course.period >= 1) && (course.period <= 3)) {
                         course.group = "Cycle 1";
                     } else if ((course.period >= 4) && (course.period <= 6)) {
@@ -149,7 +149,7 @@
             classes = tmpNewArray;
 
             //Automatically sort and group classes if enabled
-            if (window.localStorage.getItem("pref-autoGroupClasses") !== "false") {
+            if (!dtps.user.parent && (window.localStorage.getItem("pref-autoGroupClasses") !== "false")) {
                 classes.sort((a, b) => {
                     return a.period - b.period;
                 });
diff --git a/scripts/search.js b/scripts/search.js
index e19b61f..c36a092 100644
--- a/scripts/search.js
+++ b/scripts/search.js
@@ -13,9 +13,18 @@
  * @param term {string} The search term typed in the input box
  */
 dtps.globalSearch = function (term) {
+    //Validate search and get search vars
+    var type = $("#dtpsMainSearchBox").attr("data-search-type");
+    var courseNum = $("#dtpsMainSearchBox").attr("data-dtps-course");
+    var term = term ? decodeURI(term) : "";
+    if (!type || !courseNum) {
+        return fluid.screen("dashboard");
+    }
+
     //Ensure classes are rendered in the sidebar
     dtps.presentClass("search");
     dtps.showClasses();
+    dtps.selectedContent = "stream";
 
     //Clear active state from all tabs
     $("#dtpsTabBar .btn").removeClass("active");
@@ -36,25 +45,360 @@
         `
     )).join(""));
 
-    return;
+    //Fetch everything
+    var dataset = [];
+    var datasetPromises = [];
 
-    var resultHTML = "";
-    var searchData = [];
+    (courseNum == "all" ? dtps.classes : [dtps.classes[Number(courseNum)]]).forEach(course => {
+        if (type.includes("assignments") || (type == "coursework") || (type == "everything")) {
+            datasetPromises.push(new Promise((resolve, reject) => {
+                if (!course.assignments) return resolve([]);
+                var res = [];
+                if (type == "missing assignments") {
+                    res = course.assignments.filter(assignment => assignment.missing);
+                } else if (type == "turned in assignments") {
+                    res = course.assignments.filter(assignment => assignment.turnedIn);
+                } else {
+                    res = course.assignments;
+                }
 
-    dtps.classes.forEach(course => {
-        if (course.assignments) {
-            //If course has assignments, add them to the combined stream array
-            searchData = searchData.concat(course.assignments);
+                resolve(res.map(assignment => ({
+                    title: assignment.title,
+                    class: course.num,
+                    body: $('<div>' + assignment.body + '</div>').text(),
+                    url: assignment.url,
+                    locatedIn: "Assignments",
+                    icon: "assignment",
+                    info: [
+                        {
+                            icon: "alarm",
+                            label: "Due",
+                            info: assignment.dueAt ? dtps.formatDate(assignment.dueAt) : null
+                        },
+                        {
+                            icon: "category",
+                            label: "Category",
+                            info: assignment.category || null
+                        }
+                    ].filter(i => i.info),
+                    icons: [
+                        {
+                            icon: assignment.missing ? "remove_circle_outline" : null,
+                            keywords: "missing"
+                        },
+                        {
+                            icon: assignment.turnedIn ? "assignment_turned_in" : null,
+                            keywords: "turned in submitted"
+                        },
+                        {
+                            icon: assignment.locked ? "lock_outline" : null,
+                            keywords: "locked"
+                        },
+                        {
+                            icon: assignment.late ? "assignment_late" : null,
+                            keywords: "late"
+                        }
+                    ].filter(i => i.icon)
+                })));
+            }));
+        }
+
+        if ((type == "modules") || (type == "coursework") || (type == "everything")) {
+            datasetPromises.push(new Promise((resolve, reject) => {
+                if (!course.modules) return resolve([]);
+                dtpsLMS.fetchModules(dtps.user.id, course.lmsID).then(data => {
+                    var res = [];
+                    data.forEach(module => {
+                        module.items.forEach(item => {
+                            item.locatedIn = module.title;
+                            res.push(item);
+                        });
+                    });
+
+                    resolve(res.map(item => ({
+                        title: item.title,
+                        class: course.num,
+                        url: item.url,
+                        locatedIn: item.locatedIn,
+                        icon: "view_module",
+                        info: [
+                            {
+                                icon: "category",
+                                label: "Type",
+                                info: item.type
+                            }
+                        ].filter(i => i.info),
+                        icons: [
+                            {
+                                icon: item.completed ? "check" : null,
+                                keywords: "completed done submitted"
+                            }
+                        ].filter(i => i.icon)
+                    })));
+                }).catch(() => resolve([]));
+            }));
+        }
+
+        if ((type == "homepages") || (type == "everything")) {
+            datasetPromises.push(new Promise((resolve, reject) => {
+                if (!course.homepage) return resolve([]);
+                dtpsLMS.fetchHomepage(course.lmsID).then(data => {
+                    resolve([{
+                        title: course.subject + " Homepage",
+                        class: course.num,
+                        locatedIn: course.subject,
+                        icon: "home",
+                        body: $('<div>' + data + '</div>').text()
+                    }]);
+                }).catch(() => resolve([]));
+            }));
+        }
+
+        if ((type == "pages") || (type == "everything")) {
+            datasetPromises.push(new Promise((resolve, reject) => {
+                if (!course.pages) return resolve([]);
+                dtpsLMS.fetchPages(course.lmsID).then(pages => {
+                    Promise.all(pages.map(page => (
+                        dtpsLMS.fetchPageContent(course.lmsID, page.id)
+                    ))).then(pages => {
+                        resolve(pages.map(page => ({
+                            title: page.title,
+                            class: course.num,
+                            body: $('<div>' + page.content + '</div>').text(),
+                            locatedIn: "Pages",
+                            icon: "insert_drive_file",
+                            info: [
+                                {
+                                    icon: "person",
+                                    label: "Author",
+                                    info: page.author && page.author.name || null
+                                }
+                            ].filter(i => i.info),
+                            icons: []
+                        })));
+                    })
+                }).catch(() => resolve([]));
+            }));
+        }
+
+        if ((type == "discussions") || (type == "everything")) {
+            datasetPromises.push(new Promise((resolve, reject) => {
+                if (!course.discussions) return resolve([]);
+                dtpsLMS.fetchDiscussionThreads(course.lmsID).then(discussions => {
+                    Promise.all(discussions.map(discussion => (
+                        dtpsLMS.fetchDiscussionPosts(course.lmsID, discussion.id)
+                    ))).then(discussions => {
+                        var res = [];
+                        discussions.forEach(discussion => {
+                            discussion.posts.forEach(post => {
+                                post.locatedIn = discussion.title;
+                                res.push(post);
+                            })
+                        });
+                        resolve(res.map(post => ({
+                            body: $('<div>' + post.body + '</div>').text(),
+                            class: course.num,
+                            url: post.replyURL,
+                            locatedIn: post.locatedIn,
+                            icon: "forum",
+                            info: [
+                                {
+                                    icon: "person",
+                                    label: "Author",
+                                    info: post.author && post.author.name || null
+                                },
+                                {
+                                    icon: "calendar_today",
+                                    label: "Posted At",
+                                    info: post.postedAt ? dtps.formatDate(post.postedAt) : null
+                                }
+                            ].filter(i => i.info),
+                            icons: []
+                        })));
+                    })
+                }).catch(() => resolve([]));
+            }));
+        }
+
+        if ((type == "people") || (type == "everything")) {
+            datasetPromises.push(new Promise((resolve, reject) => {
+                if (!course.people) return resolve([]);
+                dtpsLMS.fetchUsers(course.lmsID).then(data => {
+                    var res = [];
+                    data.forEach(section => {
+                        section.users.forEach(user => {
+                            user.locatedIn = section.title;
+                            res.push(user);
+                        });
+                    });
+                    resolve(res.map(person => ({
+                        title: person.name,
+                        class: course.num,
+                        url: person.url,
+                        locatedIn: person.locatedIn,
+                        icon: "people",
+                        info: [],
+                        icons: []
+                    })));
+                }).catch(() => resolve([]));
+            }));
         }
     });
 
-    var search = new Fuse(searchData, {
-        keys: ["title", "body"],
-        includeMatches: true
+    Promise.all(datasetPromises).then(results => {
+        results.forEach(result => {
+            dataset = dataset.concat(result);
+        });
+
+        var search = new Fuse(dataset, {
+            keys: [{
+                name: "title",
+                weight: 1
+            },
+            {
+                name: "body",
+                weight: 0.8
+            },
+            {
+                name: "locatedIn",
+                weight: 0.7
+            },
+            {
+                name: "info.info",
+                weight: 0.6
+            },
+            {
+                name: "icons.keywords",
+                weight: 0.4
+            }],
+            includeMatches: true,
+            ignoreLocation: true,
+            //threshold: 0
+        });
+
+        if (term) {
+            var result = search.search(term);
+            if (result.length > 10) result.length = 10;
+        } else {
+            var result = dataset.map(item => ({ item: item, matches: [] }));
+        }
+
+        console.log(dataset, term, result);
+
+        $(".classContent").html(result.map(res => dtps.renderSearchResult(res.item, res.matches, courseNum == "all")));
     });
 }
 
+/**
+ * Renders a Search data object into HTML for display in the search results list
+ * 
+ * @param {SearchData} result The search result to render
+ * @param {Object[]} matches The list of matches from Fuse.js
+ * @param {boolean} [mixedClasses] True if there are results from multiple classes
+ * @return {string} The HTML for this result in the results list
+ */
+dtps.renderSearchResult = function (result, matches, mixedClasses) {
+    //A function that highlights a string between the specified indicies
+    function highlightString(string, indicies) {
+        var parts = string.split("");
+        indicies.forEach(ind => {
+            //highlight part
+            parts.forEach((part, i) => {
+                if (i == ind[0]) {
+                    parts[i] = '<span class="highlight">' + parts[i];
+                }
+
+                if (i == ind[1]) {
+                    parts[i] = parts[i] + '</span>';
+                }
+            });
+        });
+
+        return parts.join("");
+    }
+
+    //Highlight matches
+    var bodyParts = [];
+    var bodyOverflow = 0;
+    var highlightedIcons = [];
+    matches.forEach(match => {
+        if (match.key == "title") {
+            result.title = highlightString(result.title, match.indices);
+        } else if (match.key == "locatedIn") {
+            result.locatedIn = highlightString(result.locatedIn, match.indices);
+        } else if (match.key == "body") {
+            //Get longest 2 matches
+            var sections = match.indices.sort((a, b) => (b[1] - b[0]) - (a[1] - a[0]));
+            var matchesToDisplay = 2;
+            if (sections.length < matchesToDisplay) matchesToDisplay = sections.length;
+            bodyOverflow = sections.length - matchesToDisplay;
+
+            for (var i = 0; i < matchesToDisplay; i++) {
+                var startIndex = sections[i][0] - 10;
+                var endIndex = sections[i][1] + 10;
+
+                if (startIndex < 0) startIndex = 0;
+                if (endIndex > (result.body.length - 1)) endIndex = result.body.length - 1;
+
+                var res = result.body.slice(startIndex, sections[i][0]) + '<span class="highlight">' + result.body.slice(sections[i][0], sections[i][1] + 1) + '</span>' + result.body.slice(sections[i][1] + 1, endIndex + 1);
+                bodyParts.push(res);
+            }
+        } else if (match.key == "info.info") {
+            result.info[match.refIndex].info = highlightString(result.info[match.refIndex].info, match.indices);
+        } else if (match.key == "icons.keywords") {
+            highlightedIcons.push(match.refIndex);
+        }
+    });
+
+    return /*html*/`
+        <div 
+            class="card searchResult ${mixedClasses ? "mixedClasses" : ""}"
+            style="${'--classColor: ' + dtps.classes[result.class].color}"
+        >
+
+            <!-- Color bar for the dashboard -->
+            <div class="colorBar"></div>
+
+            <!-- Assignment title and points -->
+            ${result.title ? `<h4>${result.title}</h4>` : ""}
+
+            <h5>
+                <div class="infoChip"><i style="margin-top: -2px;" class="material-icons">${result.icon}</i> ${result.locatedIn}</div>
+                ${result.info.map(info => (
+        `<div class="infoChip"><i style="margin-top: -2px;" class="material-icons">${info.icon}</i> ${info.label}: ${info.info}</div>`
+    )).join("")}
+            </h5>
+
+            ${bodyParts.map(part => (
+        `<p><span style="color: var(--secText);">...</span>${part}<span style="color: var(--secText);">...</span></p>`
+    )).join("")}
+            ${bodyOverflow ? `<p style="color: var(--secText);">+${bodyOverflow} more matches</p>` : ""}
+
+            <h5>
+                ${result.icons.map((icon, i) => (
+                    highlightedIcons.includes(i) ? 
+                    `<span class="highlight"><i class="material-icons statusIcon">${icon.icon}</i></span>`
+                    : `<i class="material-icons statusIcon">${icon.icon}</i>`
+    )).join("")}
+            </h5>
+        </div>
+    `;
+}
+
 //Fluid UI screen definitions
 fluid.externalScreens.search = (term) => {
     dtps.globalSearch(term);
-}
\ No newline at end of file
+}
+
+/**
+ * @typedef {Object} SearchData
+ * @description An object that can represent any type of data to be searched.
+ * @property {string} [title] Result title
+ * @property {string} [body] Result body (can be HTML)
+ * @property {string} [url] A URL for opening this result in the LMS
+ * @property {string} locatedIn Describes where this result was found (as specific as possible)
+ * @property {string} icon The icon to use for this result. Should match (and is displayed with) the locatedIn property.
+ * @property {Object[]} info Contains any info (e.g. due dates) for this result. Has an icon property, label property, and info property.
+ * @property {Object[]} icons Status icons for this result. Has an "icon" property, for the icon, and a "keywords" property for a string with all of the search keywords for the icon.
+ * @property {number} class The number of the class that this result is from
+ */
\ No newline at end of file