testing search function
This commit is contained in:
parent
0b6f25f2ab
commit
193f2cf121
@ -66,6 +66,7 @@ class SearchPage extends Page {
|
|||||||
$mayMatchArray = array();
|
$mayMatchArray = array();
|
||||||
|
|
||||||
foreach($terms as $key => $term) {
|
foreach($terms as $key => $term) {
|
||||||
|
var_dump("key-term map", $key, $term);
|
||||||
foreach($term as $value => $parsedTerm) {
|
foreach($term as $value => $parsedTerm) {
|
||||||
switch ($parsedTerm[0]) {
|
switch ($parsedTerm[0]) {
|
||||||
case "+":
|
case "+":
|
||||||
@ -79,19 +80,19 @@ class SearchPage extends Page {
|
|||||||
if (!array_key_exists($key, $cannotMatchArray)) {
|
if (!array_key_exists($key, $cannotMatchArray)) {
|
||||||
$cannotMatchArray[$key] = array();
|
$cannotMatchArray[$key] = array();
|
||||||
}
|
}
|
||||||
$cannotMatchArray[] = array($key => substr($parsedTerm, 1));
|
$cannotMatchArray[$key][] = array($key => substr($parsedTerm, 1));
|
||||||
break;
|
break;
|
||||||
case "~":
|
case "~":
|
||||||
if (!array_key_exists($key, $mayMatchArray)) {
|
if (!array_key_exists($key, $mayMatchArray)) {
|
||||||
$mayMatchArray[$key] = array();
|
$mayMatchArray[$key] = array();
|
||||||
}
|
}
|
||||||
$mayMatchArray[] = array($key => substr($parsedTerm, 1));
|
$mayMatchArray[$key][] = array($key => substr($parsedTerm, 1));
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
if (!array_key_exists($key, $mayMatchArray)) {
|
if (!array_key_exists($key, $mayMatchArray)) {
|
||||||
$mayMatchArray[$key] = array();
|
$mayMatchArray[$key] = array();
|
||||||
}
|
}
|
||||||
$mayMatchArray[] = array($key => $parsedTerm);
|
$mayMatchArray[$key][] = array($key => $parsedTerm);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -99,6 +100,7 @@ class SearchPage extends Page {
|
|||||||
|
|
||||||
$items = get_items($type);
|
$items = get_items($type);
|
||||||
$sanitizedItems = array();
|
$sanitizedItems = array();
|
||||||
|
$out = array();
|
||||||
foreach($items as $item) {
|
foreach($items as $item) {
|
||||||
$result = $item->matches($mustMatchArray, True);
|
$result = $item->matches($mustMatchArray, True);
|
||||||
if($result) {
|
if($result) {
|
||||||
@ -146,7 +148,7 @@ class SearchPage extends Page {
|
|||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
print('DEBUG $sanitizedItem: ');
|
print('DEBUG $out: ');
|
||||||
var_dump($out);
|
var_dump($out);
|
||||||
print('<br><br>');
|
print('<br><br>');
|
||||||
// foreach($sanitizedItems as $sanitizedItem) {
|
// foreach($sanitizedItems as $sanitizedItem) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user