testing search function
This commit is contained in:
parent
9c27f70a77
commit
1db730b2ca
@ -66,12 +66,11 @@ class SearchPage extends Page {
|
||||
/*
|
||||
==================================================
|
||||
|
||||
$terms = array(??,??,??)
|
||||
$term = tbd
|
||||
$terms = array av arrayer
|
||||
$term = array(key, parsedTerm)
|
||||
$key = e.g. "Fritext", "Tag", etc
|
||||
$parsedTerm = e.g. "c426", "Dell"
|
||||
$value = ????
|
||||
$i = ????
|
||||
$value = någon form av key
|
||||
$type = users, products
|
||||
|
||||
==================================================
|
||||
@ -84,25 +83,9 @@ class SearchPage extends Page {
|
||||
foreach($terms as $key => $term) {
|
||||
foreach($term as $value => $parsedTerm) {
|
||||
|
||||
print('DEBUG VAR_DUMP $terms: ');
|
||||
var_dump($terms);
|
||||
print('<br>');
|
||||
print('DEBUG VAR_DUMP $key: ');
|
||||
var_dump($key);
|
||||
print('<br>');
|
||||
print('DEBUG VAR_DUMP $term: ');
|
||||
var_dump($term);
|
||||
print('<br>');
|
||||
print('DEBUG VAR_DUMP $value: ');
|
||||
var_dump($value);
|
||||
print('<br>');
|
||||
print('DEBUG VAR_DUMP $parsedTerm: ');
|
||||
var_dump($parsedTerm);
|
||||
print('<br>');
|
||||
print('<br>');
|
||||
|
||||
switch ($parsedTerm[0]) {
|
||||
case "+":
|
||||
// gör $mustIncludeArray till en array av arrayer?
|
||||
$mustIncludeArray[$key] = substr($parsedTerm, 1);
|
||||
break;
|
||||
case "!":
|
||||
@ -116,48 +99,45 @@ class SearchPage extends Page {
|
||||
$canIncludeArray[$key] = $parsedTerm;
|
||||
break;
|
||||
}
|
||||
|
||||
print('DEBUG VAR_DUMP $mustIncludeArray: ');
|
||||
var_dump($mustIncludeArray);
|
||||
print('<br>');
|
||||
print('DEBUG VAR_DUMP $mustExcludeArray: ');
|
||||
var_dump($mustExcludeArray);
|
||||
print('<br>');
|
||||
print('DEBUG VAR_DUMP $canIncludeArray: ');
|
||||
var_dump($canIncludeArray);
|
||||
print('<br>');
|
||||
print('<br>');
|
||||
}
|
||||
}
|
||||
|
||||
$items = get_items($type);
|
||||
$sanitizedDB = array();
|
||||
$out = array();
|
||||
// $sanitizedDB = array();
|
||||
foreach($items as $item) {
|
||||
|
||||
$mustMatchCheck = array();
|
||||
foreach($mustIncludeArray as $i => $mustIncludeTerm) { // pajar om Arrayen enbart har ett item???
|
||||
|
||||
// $mustIncludeTermCheck = $item->matches($mustIncludeTerm); // matchar inte korrekt???
|
||||
// if ($mustIncludeTermCheck) {
|
||||
// $mustMatchCheck[] = array(True);
|
||||
// print('DEBUG TRUE added to $mustMatchCheck[] ');
|
||||
// print('<br>');
|
||||
// }
|
||||
// else {
|
||||
// $mustMatchCheck[] = array(False);
|
||||
// print('DEBUG FALSE added to $mustMatchCheck[] ');
|
||||
// print('<br>');
|
||||
// }
|
||||
// print('<br>');
|
||||
// $mustMatchCheck = array();
|
||||
if ($item->matches($mustExcludeArray)) {
|
||||
// === IF TRUE DO NOTHING ===
|
||||
} else {
|
||||
$result = $item->matches($canIncludeArray);
|
||||
if($result) {
|
||||
$out[] = array($item, $result);
|
||||
}
|
||||
}
|
||||
// foreach($mustIncludeArray as $mustIncludeTerm) { // pajar om Arrayen enbart har ett item???
|
||||
|
||||
// // $mustIncludeTermCheck = $item->matches($mustIncludeTerm); // matchar inte korrekt???
|
||||
// // if ($mustIncludeTermCheck) {
|
||||
// // $mustMatchCheck[] = array(True);
|
||||
// // print('DEBUG TRUE added to $mustMatchCheck[] ');
|
||||
// // print('<br>');
|
||||
// // }
|
||||
// // else {
|
||||
// // $mustMatchCheck[] = array(False);
|
||||
// // print('DEBUG FALSE added to $mustMatchCheck[] ');
|
||||
// // print('<br>');
|
||||
// // }
|
||||
// // print('<br>');
|
||||
// }
|
||||
// print('<br>');
|
||||
|
||||
// if (array_product($mustMatchCheck)) {
|
||||
// $sanitizedDB[] = array($item, $mustIncludeTermCheck);
|
||||
// }
|
||||
}
|
||||
|
||||
$out = array();
|
||||
// $out = array();
|
||||
// foreach ($sanitizedDB as $sanitizedItem) {
|
||||
// if ($sanitizedItem->matches($mustExcludeArray)) {
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user