cleaning up debug output

This commit is contained in:
Viktor Pedersen 2021-09-13 11:14:46 +02:00
parent 84ee8f10d6
commit 0eebf93cca
2 changed files with 2 additions and 15 deletions

@ -111,7 +111,7 @@ class Product extends Entity {
} }
public function matches($terms, $matchAll=false) { public function matches($terms, $matchAll=false) {
print('DEBUG $terms: '); print('DEBUG $terms in matches: ');
var_dump($terms); var_dump($terms);
print('<br><br>'); print('<br><br>');
$terms = $this->specify_search($terms, array('brand', $terms = $this->specify_search($terms, array('brand',

@ -64,29 +64,17 @@ class SearchPage extends Page {
$mustMatchArray = array(); $mustMatchArray = array();
$cannotMatchArray = array(); $cannotMatchArray = array();
$mayMatchArray = array(); $mayMatchArray = array();
foreach($terms as $key => $value) { foreach($terms as $key => $value) {
var_dump("dump term: ", $value);
if(!is_array($value)) { if(!is_array($value)) {
$value = array($value); $value = array($value);
} }
foreach($value as $term) { foreach($value as $term) {
print('DEBUG $parsedTerm: ');
var_dump($term);
print('<br>DEBUG $parsedTerm[0]: ');
var_dump($term[0]);
print('<br>');
switch ($term[0]) { switch ($term[0]) {
case "+": case "+":
if (!array_key_exists($key, $mustMatchArray)) { if (!array_key_exists($key, $mustMatchArray)) {
$mustMatchArray[$key] = array(); $mustMatchArray[$key] = array();
} }
$mustMatchArray[$key][] = substr($term, 1); $mustMatchArray[$key][] = substr($term, 1);
print('DEBUG $mustMatchArray: ');
var_dump($mustMatchArray);
print('<br>');
break; break;
case "!": case "!":
case "-": case "-":
@ -113,7 +101,6 @@ 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) {
@ -160,7 +147,7 @@ class SearchPage extends Page {
// } // }
// } // }
} }
print('DEBUG $out: '); print('DEBUG $sanitizedItems: ');
var_dump($sanitizedItems); var_dump($sanitizedItems);
print('<br><br>'); print('<br><br>');
// $out = array(); // $out = array();