tesing search function
This commit is contained in:
parent
7079ba508a
commit
4976b58f84
@ -85,8 +85,6 @@ class SearchPage extends Page {
|
||||
|
||||
switch ($parsedTerm[0]) {
|
||||
case "+":
|
||||
// gör $mustIncludeArray till en array av arrayer?
|
||||
// $mustIncludeArray[] = array($key => substr($parsedTerm, 1));
|
||||
if (!in_array($key, $mustIncludeArray)) {
|
||||
$mustIncludeArray[$key] = array();
|
||||
}
|
||||
@ -94,12 +92,21 @@ class SearchPage extends Page {
|
||||
break;
|
||||
case "!":
|
||||
case "-":
|
||||
if (!in_array($key, $mustExcludeArray)) {
|
||||
$mustExcludeArray[$key] = array();
|
||||
}
|
||||
$mustExcludeArray[] = array($key => substr($parsedTerm, 1));
|
||||
break;
|
||||
case "~":
|
||||
if (!in_array($key, $canIncludeArray)) {
|
||||
$canIncludeArray[$key] = array();
|
||||
}
|
||||
$canIncludeArray[] = array($key => substr($parsedTerm, 1));
|
||||
break;
|
||||
default:
|
||||
if (!in_array($key, $canIncludeArray)) {
|
||||
$canIncludeArray[$key] = array();
|
||||
}
|
||||
$canIncludeArray[] = array($key => $parsedTerm);
|
||||
break;
|
||||
}
|
||||
@ -110,11 +117,15 @@ class SearchPage extends Page {
|
||||
$out = array();
|
||||
foreach($items as $item) {
|
||||
|
||||
print('<br>');
|
||||
print($item["name"]);
|
||||
print('<br>');
|
||||
$mustMatch = $item->matches($mustIncludeArray);
|
||||
var_dump($mustMatch);
|
||||
print('<br>');
|
||||
|
||||
|
||||
|
||||
// $mustIncludeCheck = array();
|
||||
// foreach($mustIncludeArray as $mustIncludeTerm) {
|
||||
// if ($item->matches($mustIncludeTerm)) {
|
||||
@ -124,14 +135,14 @@ class SearchPage extends Page {
|
||||
// }
|
||||
// }
|
||||
|
||||
$mustExcludeCheck = array();
|
||||
foreach($mustExcludeArray as $mustExcludeTerm) {
|
||||
if ($item->matches($mustExcludeTerm)) {
|
||||
$mustExcludeCheck[] = False;
|
||||
} else {
|
||||
$mustExcludeCheck[] = True;
|
||||
}
|
||||
}
|
||||
// $mustExcludeCheck = array();
|
||||
// foreach($mustExcludeArray as $mustExcludeTerm) {
|
||||
// if ($item->matches($mustExcludeTerm)) {
|
||||
// $mustExcludeCheck[] = False;
|
||||
// } else {
|
||||
// $mustExcludeCheck[] = True;
|
||||
// }
|
||||
// }
|
||||
|
||||
// if (in_array(False, $mustIncludeCheck, True) === False) {
|
||||
// if (in_array(False, $mustExcludeCheck, True) === True) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user