search test

This commit is contained in:
Viktor Pedersen 2021-08-12 16:43:49 +02:00
parent a17ff3aaba
commit bdd8a581e2

@ -57,7 +57,7 @@ class SearchPage extends Page {
==================================================
*/
print('DEBUG terms dump: ');
/*print('DEBUG terms dump: ');
var_dump($terms);
print('<br>');
print('DEBUG terms: ');
@ -65,49 +65,29 @@ class SearchPage extends Page {
print('<br>');
print('DEBUG terms[0]: ');
print_r($terms[0]);
print('<br>');
print('<br>');*/
$mustIncludeArray = array();
$mustExcludeArray = array();
$canIncludeArray = array();
foreach($terms as $term => $i) {
$res = preg_split("/^([+-!~]?)(.*)$/", $i, -1, PREG_SPLIT_DELIM_CAPTURE);
print('DEBUG $res: ');
print_r($res);
print('<br>');
print('DEBUG $res[$i]: ');
print_r($res[$i]);
print('<br>');
print('DEBUG $res[$i][0]: ');
print_r($res[$i][0]);
print('<br>');
print('DEBUG $term: ');
print_r($term);
print('<br>');
print('DEBUG $term[$i]: ');
print_r($term[$i]);
print('<br>');
print('DEBUG $term[$i][0]: ');
print_r($term[$i][0]);
print('<br>');
print('DEBUG $term substring: ');
print_r(substr($term[$i], 1));
print('<br>');
switch ($term[$i][0]) {
case "+":
$mustIncludeArray[] = array(substr($term[$i], 1));
break;
case "!":
case "-":
$mustExcludeArray[] = array(substr($term[$i], 1));
break;
case "~":
$canIncludeArray[] = array(substr($term[$i], 1));
break;
default:
$canIncludeArray[] = array($term);
break;
foreach($terms as $key => $inputs) {
foreach($inputs as $value => $i) {
switch ($value[$i][0]) {
case "+":
$mustIncludeArray[] = array(substr($value[$i], 1));
break;
case "!":
case "-":
$mustExcludeArray[] = array(substr($value[$i], 1));
break;
case "~":
$canIncludeArray[] = array(substr($value[$i], 1));
break;
default:
$canIncludeArray[] = array($value);
break;
}
}
}