diff options
| author | Simon | 2011-04-05 14:07:04 +0200 |
|---|---|---|
| committer | Simon | 2011-04-05 14:07:04 +0200 |
| commit | 5691410e622b6245dbbf9d90a98ebfd7ace783b5 (patch) | |
| tree | 9a90f0804ed6bfd60efad33fcd839608a79d9398 /library/Pbs/Search.php | |
| parent | Suche mit "text 1" möglich (diff) | |
| download | pbs2-5691410e622b6245dbbf9d90a98ebfd7ace783b5.tar.gz pbs2-5691410e622b6245dbbf9d90a98ebfd7ace783b5.tar.xz pbs2-5691410e622b6245dbbf9d90a98ebfd7ace783b5.zip | |
fehler in suche gefixxt
Diffstat (limited to 'library/Pbs/Search.php')
| -rw-r--r-- | library/Pbs/Search.php | 25 |
1 files changed, 8 insertions, 17 deletions
diff --git a/library/Pbs/Search.php b/library/Pbs/Search.php index 138ebcf..971bdab 100644 --- a/library/Pbs/Search.php +++ b/library/Pbs/Search.php @@ -69,7 +69,6 @@ class Pbs_Search{ } $this->searcha = $searcha; $this->searchb = $searchb; - #print_a($searcha,$searchb); } public function getSearchTerm(){ return $this->searchTerm; @@ -91,33 +90,25 @@ class Pbs_Search{ foreach($this->searcha as $sk => $sv){ if($k == $sk){ if(stristr($v,$sv)){ - $com1[] = $counter; + $com1[$counter] += 1; } } } } - if(count($searchb) >= 0){ - foreach($this->searchb as $sk => $sv){ + if(count($this->searchb) >= 0){ + foreach($this->searchb as $sk => $sv){ $comm = stristr($v,$sv); if($comm != false){ - $com2[] = $counter; - break; + $com2[$counter] += 1; } } } } - - } - if (count($this->searcha) == 0){ - $data = $com2; - } - if (count($this->searchb) == 0){ - $data = $com1; - } - if (count($this->searcha) > 0 && count($this->searchb) > 0){ - $data = array_intersect($com1,$com2); + if($com2[$counter] >= count($this->searchb) && $com1[$counter] >= count($this->searcha)){ + // add item in resultlist + $data[] = $counter; + } } - $data = array_unique($data); foreach( $data as $c) $ges[] = $array[$c]; return $ges; |
