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($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) {