testing new stuff

This commit is contained in:
Viktor Pedersen 2021-09-06 11:40:48 +02:00
parent fdfd94c484
commit 29678534f3

@ -87,6 +87,10 @@ class SearchPage extends Page {
case "+":
// gör $mustIncludeArray till en array av arrayer?
$mustIncludeArray[] = array($key => substr($parsedTerm, 1));
if (!in_array($key, $mustIncludeArray)) {
$mustIncludeArray[$key] = array();
}
$mustIncludeArray[$key][] = substr($parsedTerm, 1);
break;
case "!":
case "-":
@ -101,27 +105,22 @@ class SearchPage extends Page {
}
}
}
print('DEBUG $mustIncludeArray: ');
var_dump($mustIncludeArray);
print('<br>');
print('DEBUG $mustExcludeArray: ');
var_dump($mustExcludeArray);
print('<br>');
print('DEBUG $canIncludeArray: ');
var_dump($canIncludeArray);
print('<br>');
print('<br>');
$items = get_items($type);
$out = array();
foreach($items as $item) {
print('<br>');
$mustMatch = $item->matches($mustIncludeArray);
var_dump($mustMatch);
print('<br>');
// $mustIncludeCheck = array();
// foreach($mustIncludeArray as $mustIncludeTerm) {
// if ($item->matches($mustIncludeTerm)) {
// $mustIncludeCheck[] = False;
// } else {
// $mustIncludeCheck[] = True;
// } else {
// $mustIncludeCheck[] = False;
// }
// }
@ -129,36 +128,32 @@ class SearchPage extends Page {
foreach($mustExcludeArray as $mustExcludeTerm) {
if ($item->matches($mustExcludeTerm)) {
$mustExcludeCheck[] = False;
print('Added FALSE to $mustExcludeCheck[] because of maching ');
var_dump($mustExcludeTerm);
print('<br>');
} else {
$mustExcludeCheck[] = True;
print('Added TRUE to $mustExcludeCheck[] because of not maching ');
var_dump($mustExcludeTerm);
print('<br>');
}
}
print('DEBUG $mustExcludeCheck: ');
var_dump($mustExcludeCheck);
print('<br>');
print('DEBUG $item: ');
var_dump($item);
print('<br>');
print('<br>');
if (in_array(False, $mustExcludeCheck, True) === True) {
if (in_array(False, $mustIncludeCheck, True) === False) {
if (in_array(False, $mustExcludeCheck, True) === True) {
// === IF TRUE DO NOTHING ===
// === IF TRUE DO NOTHING ===
} else {
foreach ($canIncludeArray as $canIncludeTerm) {
$result = $item->matches($canIncludeTerm);
if($result) {
$out[] = array($item, $result);
} else {
foreach ($canIncludeArray as $canIncludeTerm) {
$result = $item->matches($canIncludeTerm);
if($result) {
$out[] = array($item, $result);
}
}
}
}
else if () {
}
else {
}
}
return $out;
}