From dc3cd3251bae8defd5fafcc02e8ff8f9b1361139 Mon Sep 17 00:00:00 2001
From: Viktor Pedersen <viktor@dsv.su.se>
Date: Mon, 6 Sep 2021 17:00:03 +0200
Subject: [PATCH] search function testing

---
 include/SearchPage.php | 29 ++++++++++-------------------
 1 file changed, 10 insertions(+), 19 deletions(-)

diff --git a/include/SearchPage.php b/include/SearchPage.php
index cc87f75..2cbb9d6 100644
--- a/include/SearchPage.php
+++ b/include/SearchPage.php
@@ -103,27 +103,18 @@ class SearchPage extends Page {
         $sanitizedItems = array();
         foreach($items as $item) {
             $mustMatch = $item->matches($mustMatchArray);
-            if($mustMatch) {
+
+            $mustMatchCheck = array();
+            foreach($mustIncludeArray as $mustIncludeTerm) {
+                if (array_key_exists($mustIncludeTerm, $mustMatchCheck)) {
+                    $mustMatchCheck[] = True;
+                } else {
+                    $mustMatchCheck[] = False;
+                }
+            }
+            if(in_array(False, $mustIncludeCheck, True) === False) {
                 $sanitizedItems[] = array($item, $mustMatch);
             }
-            /* ============
-
-            if () {
-                
-                
-                
-
-            }
-            else if () {
-    
-                
-
-            }
-            else
-
-
-            */ 
-
             // $mustIncludeCheck = array();
             // foreach($mustIncludeArray as $mustIncludeTerm) {
             //     if ($item->matches($mustIncludeTerm)) {