testing search function

This commit is contained in:
Viktor Pedersen 2021-09-08 11:34:10 +02:00
parent fa765dde5e
commit b8ba31fc70

@ -68,7 +68,6 @@ class SearchPage extends Page {
foreach($terms as $key => $term) { foreach($terms as $key => $term) {
foreach($term as $value => $parsedTerm) { foreach($term as $value => $parsedTerm) {
switch ($parsedTerm[0]) { switch ($parsedTerm[0]) {
case "+": case "+":
if (!array_key_exists($key, $mustMatchArray)) { if (!array_key_exists($key, $mustMatchArray)) {
@ -102,9 +101,9 @@ class SearchPage extends Page {
$items = get_items($type); $items = get_items($type);
$sanitizedItems = array(); $sanitizedItems = array();
foreach($items as $item) { foreach($items as $item) {
$mustMatch = $item->matches($mustMatchArray, True); $result = $item->matches($mustMatchArray);
if($mustMatch) { if($result) {
$sanitizedItems[] = array($item, $mustMatch); $sanitizedItems[] = array($item, $result);
} }
// $mustMatchCheck = array(); // $mustMatchCheck = array();
@ -152,10 +151,22 @@ class SearchPage extends Page {
print('DEBUG $sanitizedItem: '); print('DEBUG $sanitizedItem: ');
var_dump($sanitizedItem); var_dump($sanitizedItem);
print('<br><br>'); print('<br><br>');
}
$out = array(); // if($sanitizedItem->matches($cannotMatchArray)) {
return $out;
// // === IF TRUE DO NOTHING ===
// }
// else {
// $result = $sanitizedItem->matches($mayMatchArray);
// if($result) {
// $out[] = array($sanitizedItem, $result);
// }
// }
// }
return array();
// return $out;
} }
private function translate_terms($terms) { private function translate_terms($terms) {