testing search function
This commit is contained in:
parent
6097c772ee
commit
3f3e8104b6
@ -58,9 +58,9 @@ class SearchPage extends Page {
|
||||
|
||||
*/
|
||||
|
||||
print('DEBUG $terms dump: ');
|
||||
var_dump($terms);
|
||||
print('<br>');
|
||||
// print('DEBUG $terms dump: ');
|
||||
// var_dump($terms);
|
||||
// print('<br>');
|
||||
|
||||
$mustIncludeArray = array();
|
||||
$mustExcludeArray = array();
|
||||
@ -83,63 +83,58 @@ class SearchPage extends Page {
|
||||
$canIncludeArray[] = array($values[$value]);
|
||||
break;
|
||||
}
|
||||
print('DEBUG $values[$value] dump: ');
|
||||
var_dump($values[$value]);
|
||||
print('<br>');
|
||||
// print('DEBUG $values[$value] dump: ');
|
||||
// var_dump($values[$value]);
|
||||
// print('<br>');
|
||||
}
|
||||
print('DEBUG $key dump: ');
|
||||
var_dump($key);
|
||||
print('<br>');
|
||||
// print('DEBUG $key dump: ');
|
||||
// var_dump($key);
|
||||
// print('<br>');
|
||||
}
|
||||
|
||||
print('DEBUG mustIncludeArray: ');
|
||||
print_r($mustIncludeArray);
|
||||
print('<br>');
|
||||
print('DEBUG mustExcludeArray: ');
|
||||
print_r($mustExcludeArray);
|
||||
print('<br>');
|
||||
print('DEBUG canIncludeArray: ');
|
||||
print_r($canIncludeArray);
|
||||
print('<br>');
|
||||
// print('DEBUG mustIncludeArray: ');
|
||||
// print_r($mustIncludeArray);
|
||||
// print('<br>');
|
||||
// print('DEBUG mustExcludeArray: ');
|
||||
// print_r($mustExcludeArray);
|
||||
// print('<br>');
|
||||
// print('DEBUG canIncludeArray: ');
|
||||
// print_r($canIncludeArray);
|
||||
// print('<br>');
|
||||
|
||||
$items = get_items($type);
|
||||
// $cannotMatchResults = $item->matches($mustExcludeArray);
|
||||
// $mustMatchResults = $item->matches($mustIncludeArray);
|
||||
// $canMatchResults = $item->matches($canIncludeArray);
|
||||
$sanitizedDB = array();
|
||||
$out = array();
|
||||
$mustMatchCheck = False;
|
||||
|
||||
foreach($items as $item) {
|
||||
$mustExcludeCheck = True;
|
||||
$resultExclude = $item->matches($mustExcludeArray);
|
||||
if($resultExclude) {
|
||||
|
||||
// if resultExclude is matching, do === nothing ===
|
||||
|
||||
} else {
|
||||
$canIncludeResult = $item->matches($canIncludeArray);
|
||||
$out[] = array($item, $canIncludeResult);
|
||||
/*
|
||||
$mustIncludeCheck = False;
|
||||
if(count($mustIncludeArray) > 0) {
|
||||
foreach($mustIncludeArray as $mustIncludeArgument) {
|
||||
$resultInclude = $item->matches($mustIncludeArgument);
|
||||
if($resultInclude) {
|
||||
$mustIncludeCheck = True;
|
||||
} else {
|
||||
$mustIncludeCheck = False;
|
||||
break;
|
||||
}
|
||||
}
|
||||
foreach ($mustMatchResults as $matchResult) {
|
||||
if($item->matches($mustIncludeArray)) {
|
||||
$mustMatchCheck = True;
|
||||
} else {
|
||||
$mustMatchCheck = False;
|
||||
break;
|
||||
}
|
||||
if ($mustIncludeCheck) {
|
||||
if(count($canIncludeArray) > 0) {
|
||||
$canIncludeResult = $item->matches($canIncludeArray);
|
||||
$out[] = array($item, $canIncludeResult);
|
||||
} else {
|
||||
$mustIncludeResult = $item->matches($mustIncludeArray);
|
||||
$out[] = array($item, $mustIncludeResult);
|
||||
}
|
||||
}*/
|
||||
}
|
||||
if ($mustMatchCheck) {
|
||||
$sanitizedDB[] = array($item)
|
||||
}
|
||||
}
|
||||
foreach ($sanitizedDB as $sanitizedItem) {
|
||||
if ($sanitizedItem->matches($mustExcludeArray)) {
|
||||
|
||||
// === IF TRUE DO NOTHING ===
|
||||
|
||||
} else {
|
||||
$result = $sanitizedItem->matches($canIncludeArray);
|
||||
if($result) {
|
||||
$out[] = array($sanitizedItem, $result);
|
||||
}
|
||||
}
|
||||
}
|
||||
return $out;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user