From b8ba31fc70a9b6aeb16d307527ad06786fcc5ffc Mon Sep 17 00:00:00 2001 From: Viktor Pedersen <viktor@dsv.su.se> Date: Wed, 8 Sep 2021 11:34:10 +0200 Subject: [PATCH] testing search function --- include/SearchPage.php | 31 +++++++++++++++++++++---------- 1 file changed, 21 insertions(+), 10 deletions(-) diff --git a/include/SearchPage.php b/include/SearchPage.php index ea9d9b3..2b23da8 100644 --- a/include/SearchPage.php +++ b/include/SearchPage.php @@ -68,7 +68,6 @@ class SearchPage extends Page { foreach($terms as $key => $term) { foreach($term as $value => $parsedTerm) { - switch ($parsedTerm[0]) { case "+": if (!array_key_exists($key, $mustMatchArray)) { @@ -102,16 +101,16 @@ class SearchPage extends Page { $items = get_items($type); $sanitizedItems = array(); foreach($items as $item) { - $mustMatch = $item->matches($mustMatchArray, True); - if($mustMatch) { - $sanitizedItems[] = array($item, $mustMatch); + $result = $item->matches($mustMatchArray); + if($result) { + $sanitizedItems[] = array($item, $result); } // $mustMatchCheck = array(); // foreach($mustMatchArray as $mustMatchTerm) { // $matchResult = $item->matches($mustMatchTerm); - // if ($matchResult) { + // if($matchResult) { // $mustMatchCheck[] = True; // } else { // $mustMatchCheck[] = False; @@ -125,7 +124,7 @@ class SearchPage extends Page { // $mustExcludeCheck = array(); // foreach($mustExcludeArray as $mustExcludeTerm) { - // if ($item->matches($mustExcludeTerm)) { + // if($item->matches($mustExcludeTerm)) { // $mustExcludeCheck[] = False; // } else { // $mustExcludeCheck[] = True; @@ -133,7 +132,7 @@ class SearchPage extends Page { // } // if (in_array(False, $mustIncludeCheck, True) === False) { - // if (in_array(False, $mustExcludeCheck, True) === True) { + // if(in_array(False, $mustExcludeCheck, True) === True) { // // === IF TRUE DO NOTHING === @@ -152,10 +151,22 @@ class SearchPage extends Page { print('DEBUG $sanitizedItem: '); var_dump($sanitizedItem); print('<br><br>'); - } - $out = array(); - return $out; + // if($sanitizedItem->matches($cannotMatchArray)) { + + // // === IF TRUE DO NOTHING === + + // } + // else { + // $result = $sanitizedItem->matches($mayMatchArray); + // if($result) { + // $out[] = array($sanitizedItem, $result); + // } + // } + // } + + return array(); + // return $out; } private function translate_terms($terms) {